下記の内容をAzure上のCloud ShellからTerraformでやってみる。
プロジェクト用のディレクトリを作成
コマンド
mkdir vgw && cd vgw
テンプレートファイルを作成
プロバイダ設定用 (providers.tf)
providers.tf
terraform {
required_version = ">=0.12"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>2.0"
}
}
}
provider "azurerm" {
features {}
}
リソース グループ用 (rg.tf)
rg.tf
resource "azurerm_resource_group" "TestRG1" {
name = "TestRG1"
location = "eastus"
}
VPNゲートウェイ用 (net.tf)
net.tf
# リソースグループ環境変数
locals {
rg_name = "TestRG1"
rg_location = "eastus"
}
# 仮想ネットワーク
resource "azurerm_virtual_network" "VNet1" {
name = "VNet1"
location = local.rg_location
resource_group_name = local.rg_name
address_space = ["10.1.0.0/16"]
subnet {
name = "Frontend"
address_prefix = "10.1.0.0/24"
}
}
# ゲートウェイ サブネット
resource "azurerm_subnet" "GatewaySubnet" {
name = "GatewaySubnet"
resource_group_name = local.rg_name
virtual_network_name = azurerm_virtual_network.VNet1.name
address_prefixes = ["10.1.255.0/27"]
}
# パブリック IP アドレス
resource "azurerm_public_ip" "VNet1GWIP" {
name = "VNet1GWIP"
resource_group_name = local.rg_name
location = local.rg_location
allocation_method = "Dynamic"
}
# VPN ゲートウェイ
resource "azurerm_virtual_network_gateway" "VNet1GW" {
name = "VNet1GW"
location = local.rg_location
resource_group_name = local.rg_name
type = "Vpn"
vpn_type = "RouteBased"
sku = "VpnGw1"
ip_configuration {
public_ip_address_id = azurerm_public_ip.VNet1GWIP.id
subnet_id = azurerm_subnet.GatewaySubnet.id
}
}
Terraformで構築
初期化
コマンド
terraform init -upgrade
出力
[ ~/vgw ]$ terraform init -upgrade
Initializing the backend...
Initializing provider plugins...
- Finding hashicorp/azurerm versions matching "~> 2.0"...
- Finding hashicorp/random versions matching "~> 3.0"...
- Installing hashicorp/azurerm v2.99.0...
- Installed hashicorp/azurerm v2.99.0 (signed by HashiCorp)
- Installing hashicorp/random v3.5.1...
- Installed hashicorp/random v3.5.1 (signed by HashiCorp)
Terraform has made some changes to the provider dependency selections recorded
in the .terraform.lock.hcl file. Review those changes and commit them to your
version control system if they represent changes you intended to make.
Terraform has been successfully initialized!
You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.
If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
実行プランを作成
コマンド
terraform plan -out main.tfplan
出力
[ ~/vgw ]$ terraform plan -out main.tfplan
azurerm_resource_group.TestRG1: Refreshing state... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1]
azurerm_public_ip.VNet1GWIP: Refreshing state... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1/providers/Microsoft.Network/publicIPAddresses/VNet1GWIP]
azurerm_virtual_network.VNet1: Refreshing state... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1/providers/Microsoft.Network/virtualNetworks/VNet1]
azurerm_subnet.GatewaySubnet: Refreshing state... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1/providers/Microsoft.Network/virtualNetworks/VNet1/subnets/GatewaySubnet]
azurerm_virtual_network_gateway.VNet1GW: Refreshing state... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1/providers/Microsoft.Network/virtualNetworkGateways/VNet1GW]
Note: Objects have changed outside of Terraform
Terraform detected the following changes made outside of Terraform since the last "terraform apply" which may have affected this plan:
# azurerm_public_ip.VNet1GWIP has been deleted
- resource "azurerm_public_ip" "VNet1GWIP" {
- id = "/subscriptions/********-****-****-****-************/resourceGroups/TestRG1/providers/Microsoft.Network/publicIPAddresses/VNet1GWIP" -> null
name = "VNet1GWIP"
tags = {}
# (8 unchanged attributes hidden)
}
# azurerm_subnet.GatewaySubnet has been deleted
- resource "azurerm_subnet" "GatewaySubnet" {
- id = "/subscriptions/********-****-****-****-************/resourceGroups/TestRG1/providers/Microsoft.Network/virtualNetworks/VNet1/subnets/GatewaySubnet" -> null
name = "GatewaySubnet"
# (8 unchanged attributes hidden)
}
# azurerm_virtual_network.VNet1 has been deleted
- resource "azurerm_virtual_network" "VNet1" {
id = "/subscriptions/********-****-****-****-************/resourceGroups/TestRG1/providers/Microsoft.Network/virtualNetworks/VNet1"
- name = "VNet1" -> null
tags = {}
# (7 unchanged attributes hidden)
}
Unless you have made equivalent changes to your configuration, or ignored the relevant attributes using ignore_changes, the following plan may
include actions to undo or respond to these changes.
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# azurerm_public_ip.VNet1GWIP will be created
+ resource "azurerm_public_ip" "VNet1GWIP" {
+ allocation_method = "Dynamic"
+ availability_zone = (known after apply)
+ fqdn = (known after apply)
+ id = (known after apply)
+ idle_timeout_in_minutes = 4
+ ip_address = (known after apply)
+ ip_version = "IPv4"
+ location = "eastus"
+ name = "VNet1GWIP"
+ resource_group_name = "TestRG1"
+ sku = "Basic"
+ sku_tier = "Regional"
+ zones = (known after apply)
}
# azurerm_resource_group.TestRG1 will be created
+ resource "azurerm_resource_group" "TestRG1" {
+ id = (known after apply)
+ location = "eastus"
+ name = "TestRG1"
}
# azurerm_subnet.GatewaySubnet will be created
+ resource "azurerm_subnet" "GatewaySubnet" {
+ address_prefix = (known after apply)
+ address_prefixes = [
+ "10.1.255.0/27",
]
+ enforce_private_link_endpoint_network_policies = false
+ enforce_private_link_service_network_policies = false
+ id = (known after apply)
+ name = "GatewaySubnet"
+ resource_group_name = "TestRG1"
+ virtual_network_name = "VNet1"
}
# azurerm_virtual_network.VNet1 will be created
+ resource "azurerm_virtual_network" "VNet1" {
+ address_space = [
+ "10.1.0.0/16",
]
+ dns_servers = (known after apply)
+ guid = (known after apply)
+ id = (known after apply)
+ location = "eastus"
+ name = "VNet1"
+ resource_group_name = "TestRG1"
+ subnet = [
+ {
+ address_prefix = "10.1.0.0/24"
+ id = (known after apply)
+ name = "Frontend"
+ security_group = ""
},
]
+ vm_protection_enabled = false
}
# azurerm_virtual_network_gateway.VNet1GW will be created
+ resource "azurerm_virtual_network_gateway" "VNet1GW" {
+ active_active = (known after apply)
+ enable_bgp = (known after apply)
+ generation = (known after apply)
+ id = (known after apply)
+ location = "eastus"
+ name = "VNet1GW"
+ resource_group_name = "TestRG1"
+ sku = "VpnGw1"
+ type = "Vpn"
+ vpn_type = "RouteBased"
+ ip_configuration {
+ name = "vnetGatewayConfig"
+ private_ip_address_allocation = "Dynamic"
+ public_ip_address_id = (known after apply)
+ subnet_id = (known after apply)
}
}
Plan: 5 to add, 0 to change, 0 to destroy.
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Saved the plan to: main.tfplan
To perform exactly these actions, run the following command to apply:
terraform apply "main.tfplan"
実行プランを適用
コマンド
terraform apply main.tfplan
出力 ※エラーになるリソースグループの作成が間に合わない?
[ ~/vgw ]$ terraform apply main.tfplan
azurerm_resource_group.TestRG1: Creating...
azurerm_virtual_network.VNet1: Creating...
azurerm_public_ip.VNet1GWIP: Creating...
azurerm_resource_group.TestRG1: Creation complete after 4s [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1]
╷
│ Error: creating/updating Virtual Network: (Name "VNet1" / Resource Group "TestRG1"): network.VirtualNetworksClient#CreateOrUpdate: Failure sending request: StatusCode=404 -- Original Error: Code="ResourceGroupNotFound" Message="Resource group 'TestRG1' could not be found."
│
│ with azurerm_virtual_network.VNet1,
│ on net.tf line 11, in resource "azurerm_virtual_network" "VNet1":
│ 11: resource "azurerm_virtual_network" "VNet1" {
│
╵
╷
│ Error: creating/updating Public Ip Address: (Name "VNet1GWIP" / Resource Group "TestRG1"): network.PublicIPAddressesClient#CreateOrUpdate: Failure sending request: StatusCode=404 -- Original Error: Code="ResourceGroupNotFound" Message="Resource group 'TestRG1' could not be found."
│
│ with azurerm_public_ip.VNet1GWIP,
│ on net.tf line 30, in resource "azurerm_public_ip" "VNet1GWIP":
│ 30: resource "azurerm_public_ip" "VNet1GWIP" {
│
╵
実行プランを再作成
コマンド
terraform plan -out main.tfplan
出力
[ ~/vgw ]$ terraform plan -out main.tfplan
azurerm_resource_group.TestRG1: Refreshing state... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1]
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# azurerm_public_ip.VNet1GWIP will be created
+ resource "azurerm_public_ip" "VNet1GWIP" {
+ allocation_method = "Dynamic"
+ availability_zone = (known after apply)
+ fqdn = (known after apply)
+ id = (known after apply)
+ idle_timeout_in_minutes = 4
+ ip_address = (known after apply)
+ ip_version = "IPv4"
+ location = "eastus"
+ name = "VNet1GWIP"
+ resource_group_name = "TestRG1"
+ sku = "Basic"
+ sku_tier = "Regional"
+ zones = (known after apply)
}
# azurerm_subnet.GatewaySubnet will be created
+ resource "azurerm_subnet" "GatewaySubnet" {
+ address_prefix = (known after apply)
+ address_prefixes = [
+ "10.1.255.0/27",
]
+ enforce_private_link_endpoint_network_policies = false
+ enforce_private_link_service_network_policies = false
+ id = (known after apply)
+ name = "GatewaySubnet"
+ resource_group_name = "TestRG1"
+ virtual_network_name = "VNet1"
}
# azurerm_virtual_network.VNet1 will be created
+ resource "azurerm_virtual_network" "VNet1" {
+ address_space = [
+ "10.1.0.0/16",
]
+ dns_servers = (known after apply)
+ guid = (known after apply)
+ id = (known after apply)
+ location = "eastus"
+ name = "VNet1"
+ resource_group_name = "TestRG1"
+ subnet = [
+ {
+ address_prefix = "10.1.0.0/24"
+ id = (known after apply)
+ name = "Frontend"
+ security_group = ""
},
]
+ vm_protection_enabled = false
}
# azurerm_virtual_network_gateway.VNet1GW will be created
+ resource "azurerm_virtual_network_gateway" "VNet1GW" {
+ active_active = (known after apply)
+ enable_bgp = (known after apply)
+ generation = (known after apply)
+ id = (known after apply)
+ location = "eastus"
+ name = "VNet1GW"
+ resource_group_name = "TestRG1"
+ sku = "VpnGw1"
+ type = "Vpn"
+ vpn_type = "RouteBased"
+ ip_configuration {
+ name = "vnetGatewayConfig"
+ private_ip_address_allocation = "Dynamic"
+ public_ip_address_id = (known after apply)
+ subnet_id = (known after apply)
}
}
Plan: 4 to add, 0 to change, 0 to destroy.
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Saved the plan to: main.tfplan
To perform exactly these actions, run the following command to apply:
terraform apply "main.tfplan"
実行プランを再適用
コマンド
terraform apply main.tfplan
出力 ※今度は成功
[ ~/vgw ]$ terraform apply main.tfplan
azurerm_public_ip.VNet1GWIP: Creating...
azurerm_virtual_network.VNet1: Creating...
azurerm_public_ip.VNet1GWIP: Still creating... [10s elapsed]
azurerm_virtual_network.VNet1: Still creating... [10s elapsed]
azurerm_public_ip.VNet1GWIP: Creation complete after 11s [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1/providers/Microsoft.Network/publicIPAddresses/VNet1GWIP]
azurerm_virtual_network.VNet1: Creation complete after 15s [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1/providers/Microsoft.Network/virtualNetworks/VNet1]
azurerm_subnet.GatewaySubnet: Creating...
azurerm_subnet.GatewaySubnet: Still creating... [10s elapsed]
azurerm_subnet.GatewaySubnet: Creation complete after 10s [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1/providers/Microsoft.Network/virtualNetworks/VNet1/subnets/GatewaySubnet]
azurerm_virtual_network_gateway.VNet1GW: Creating...
azurerm_virtual_network_gateway.VNet1GW: Still creating... [10s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [20s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [30s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [40s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [50s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [1m0s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [1m10s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [1m20s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [1m30s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [1m40s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [1m50s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [2m0s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [2m10s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [2m20s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [2m30s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [2m40s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [2m50s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [3m0s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [3m10s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [3m20s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [3m30s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [3m40s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [3m50s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [4m0s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [4m10s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [4m20s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [4m30s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [4m40s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [4m50s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [5m0s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [5m10s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [5m20s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [5m30s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [5m40s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [5m50s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [6m0s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [6m10s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [6m20s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [6m30s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [6m40s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [6m50s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [7m0s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [7m10s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [7m20s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [7m30s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [7m40s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [7m50s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [8m0s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [8m10s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [8m20s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [8m30s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [8m40s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [8m50s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [9m0s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [9m10s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [9m20s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [9m30s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [9m40s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [9m50s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [10m0s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [10m10s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [10m20s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [10m30s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [10m40s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [10m50s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [11m0s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [11m10s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [11m20s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [11m30s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [11m40s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [11m50s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [12m0s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [12m10s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [12m20s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [12m30s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [12m40s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [12m50s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [13m0s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [13m10s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [13m20s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [13m30s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [13m40s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [13m50s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [14m0s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [14m10s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [14m20s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [14m30s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [14m40s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [14m50s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [15m0s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [15m10s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [15m20s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [15m30s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [15m40s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [15m50s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [16m0s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [16m10s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [16m20s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [16m30s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [16m40s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [16m50s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [17m0s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [17m10s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [17m20s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [17m30s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [17m40s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [17m50s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [18m0s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [18m10s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still creating... [18m20s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Creation complete after 18m22s [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1/providers/Microsoft.Network/virtualNetworkGateways/VNet1GW]
Apply complete! Resources: 4 added, 0 changed, 0 destroyed.
確認
リソース
コマンド
terraform show
出力
[ ~/vgw ]$ terraform show
# azurerm_public_ip.VNet1GWIP:
resource "azurerm_public_ip" "VNet1GWIP" {
allocation_method = "Dynamic"
availability_zone = "No-Zone"
id = "/subscriptions/********-****-****-****-************/resourceGroups/TestRG1/providers/Microsoft.Network/publicIPAddresses/VNet1GWIP"
idle_timeout_in_minutes = 4
ip_version = "IPv4"
location = "eastus"
name = "VNet1GWIP"
resource_group_name = "TestRG1"
sku = "Basic"
sku_tier = "Regional"
zones = []
}
# azurerm_resource_group.TestRG1:
resource "azurerm_resource_group" "TestRG1" {
id = "/subscriptions/********-****-****-****-************/resourceGroups/TestRG1"
location = "eastus"
name = "TestRG1"
tags = {}
}
# azurerm_subnet.GatewaySubnet:
resource "azurerm_subnet" "GatewaySubnet" {
address_prefix = "10.1.255.0/27"
address_prefixes = [
"10.1.255.0/27",
]
enforce_private_link_endpoint_network_policies = false
enforce_private_link_service_network_policies = false
id = "/subscriptions/********-****-****-****-************/resourceGroups/TestRG1/providers/Microsoft.Network/virtualNetworks/VNet1/subnets/GatewaySubnet"
name = "GatewaySubnet"
resource_group_name = "TestRG1"
virtual_network_name = "VNet1"
}
# azurerm_virtual_network.VNet1:
resource "azurerm_virtual_network" "VNet1" {
address_space = [
"10.1.0.0/16",
]
dns_servers = []
flow_timeout_in_minutes = 0
guid = "a4d0f236-50cd-4597-bbec-126cbc60f4d9"
id = "/subscriptions/********-****-****-****-************/resourceGroups/TestRG1/providers/Microsoft.Network/virtualNetworks/VNet1"
location = "eastus"
name = "VNet1"
resource_group_name = "TestRG1"
subnet = [
{
address_prefix = "10.1.0.0/24"
id = "/subscriptions/********-****-****-****-************/resourceGroups/TestRG1/providers/Microsoft.Network/virtualNetworks/VNet1/subnets/Frontend"
name = "Frontend"
security_group = ""
},
]
vm_protection_enabled = false
}
# azurerm_virtual_network_gateway.VNet1GW:
resource "azurerm_virtual_network_gateway" "VNet1GW" {
active_active = false
enable_bgp = false
generation = "Generation1"
id = "/subscriptions/********-****-****-****-************/resourceGroups/TestRG1/providers/Microsoft.Network/virtualNetworkGateways/VNet1GW"
location = "eastus"
name = "VNet1GW"
private_ip_address_enabled = false
resource_group_name = "TestRG1"
sku = "VpnGw1"
type = "Vpn"
vpn_type = "RouteBased"
bgp_settings {
asn = 65515
peer_weight = 0
peering_address = "10.1.255.30"
peering_addresses {
apipa_addresses = []
default_addresses = [
"10.1.255.30",
]
ip_configuration_name = "vnetGatewayConfig"
tunnel_ip_addresses = [
"20.232.177.186",
]
}
}
ip_configuration {
name = "vnetGatewayConfig"
private_ip_address_allocation = "Dynamic"
public_ip_address_id = "/subscriptions/********-****-****-****-************/resourceGroups/TestRG1/providers/Microsoft.Network/publicIPAddresses/VNet1GWIP"
subnet_id = "/subscriptions/********-****-****-****-************/resourceGroups/TestRG1/providers/Microsoft.Network/virtualNetworks/VNet1/subnets/GatewaySubnet"
}
}
VPN ゲートウェイを表示
コマンド
az network vnet-gateway show \
-n VNet1GW \
-g TestRG1
出力
[ ~/vgw ]$ az network vnet-gateway show \
-n VNet1GW \
-g TestRG1
{
"activeActive": false,
"bgpSettings": {
"asn": 65515,
"bgpPeeringAddress": "10.1.255.30",
"bgpPeeringAddresses": [
{
"customBgpIpAddresses": [],
"defaultBgpIpAddresses": [
"10.1.255.30"
],
"ipconfigurationId": "/subscriptions/********-****-****-****-************/resourceGroups/TestRG1/providers/Microsoft.Network/virtualNetworkGateways/VNet1GW/ipConfigurations/vnetGatewayConfig",
"tunnelIpAddresses": [
"20.232.177.186"
]
}
],
"peerWeight": 0
},
"disableIPSecReplayProtection": false,
"enableBgp": false,
"enableBgpRouteTranslationForNat": false,
"enablePrivateIpAddress": false,
"etag": "W/\"f2c5de04-5200-4023-ad16-7fb251036cfb\"",
"gatewayType": "Vpn",
"id": "/subscriptions/********-****-****-****-************/resourceGroups/TestRG1/providers/Microsoft.Network/virtualNetworkGateways/VNet1GW",
"ipConfigurations": [
{
"etag": "W/\"f2c5de04-5200-4023-ad16-7fb251036cfb\"",
"id": "/subscriptions/********-****-****-****-************/resourceGroups/TestRG1/providers/Microsoft.Network/virtualNetworkGateways/VNet1GW/ipConfigurations/vnetGatewayConfig",
"name": "vnetGatewayConfig",
"privateIPAllocationMethod": "Dynamic",
"provisioningState": "Succeeded",
"publicIPAddress": {
"id": "/subscriptions/********-****-****-****-************/resourceGroups/TestRG1/providers/Microsoft.Network/publicIPAddresses/VNet1GWIP",
"resourceGroup": "TestRG1"
},
"resourceGroup": "TestRG1",
"subnet": {
"id": "/subscriptions/********-****-****-****-************/resourceGroups/TestRG1/providers/Microsoft.Network/virtualNetworks/VNet1/subnets/GatewaySubnet",
"resourceGroup": "TestRG1"
}
}
],
"location": "eastus",
"name": "VNet1GW",
"natRules": [],
"provisioningState": "Succeeded",
"resourceGroup": "TestRG1",
"resourceGuid": "b08ae35c-d9b1-4295-a2de-a48fe489883b",
"sku": {
"capacity": 2,
"name": "VpnGw1",
"tier": "VpnGw1"
},
"tags": {},
"type": "Microsoft.Network/virtualNetworkGateways",
"vpnGatewayGeneration": "Generation1",
"vpnType": "RouteBased"
}
パブリック IP アドレスの表示
コマンド
az network public-ip show \
--name VNet1GWIP \
--resource-group TestRG1
出力
[ ~/vgw ]$ az network public-ip show \
--name VNet1GWIP \
--resource-group TestRG1
{
"etag": "W/\"193dca87-8307-4fd0-890c-cbc271e7d46c\"",
"id": "/subscriptions/********-****-****-****-************/resourceGroups/TestRG1/providers/Microsoft.Network/publicIPAddresses/VNet1GWIP",
"idleTimeoutInMinutes": 4,
"ipAddress": "20.232.177.186",
"ipConfiguration": {
"id": "/subscriptions/********-****-****-****-************/resourceGroups/TestRG1/providers/Microsoft.Network/virtualNetworkGateways/VNet1GW/ipConfigurations/vnetGatewayConfig",
"resourceGroup": "TestRG1"
},
"ipTags": [],
"location": "eastus",
"name": "VNet1GWIP",
"provisioningState": "Succeeded",
"publicIPAddressVersion": "IPv4",
"publicIPAllocationMethod": "Dynamic",
"resourceGroup": "TestRG1",
"resourceGuid": "2d354f64-70cf-4a5c-b3d8-2e885646539c",
"sku": {
"name": "Basic",
"tier": "Regional"
},
"tags": {}
}
リソースをクリーンアップ
Destroyプランを作成
コマンド
terraform plan -destroy -out main.destroy.tfplan
出力
[ ~/vgw ]$ terraform plan -destroy -out main.destroy.tfplan
azurerm_resource_group.TestRG1: Refreshing state... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1]
azurerm_virtual_network.VNet1: Refreshing state... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1/providers/Microsoft.Network/virtualNetworks/VNet1]
azurerm_public_ip.VNet1GWIP: Refreshing state... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1/providers/Microsoft.Network/publicIPAddresses/VNet1GWIP]
azurerm_subnet.GatewaySubnet: Refreshing state... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1/providers/Microsoft.Network/virtualNetworks/VNet1/subnets/GatewaySubnet]
azurerm_virtual_network_gateway.VNet1GW: Refreshing state... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1/providers/Microsoft.Network/virtualNetworkGateways/VNet1GW]
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
- destroy
Terraform will perform the following actions:
# azurerm_public_ip.VNet1GWIP will be destroyed
- resource "azurerm_public_ip" "VNet1GWIP" {
- allocation_method = "Dynamic" -> null
- availability_zone = "No-Zone" -> null
- id = "/subscriptions/********-****-****-****-************/resourceGroups/TestRG1/providers/Microsoft.Network/publicIPAddresses/VNet1GWIP" -> null
- idle_timeout_in_minutes = 4 -> null
- ip_address = "20.232.177.186" -> null
- ip_tags = {} -> null
- ip_version = "IPv4" -> null
- location = "eastus" -> null
- name = "VNet1GWIP" -> null
- resource_group_name = "TestRG1" -> null
- sku = "Basic" -> null
- sku_tier = "Regional" -> null
- tags = {} -> null
- zones = [] -> null
}
# azurerm_resource_group.TestRG1 will be destroyed
- resource "azurerm_resource_group" "TestRG1" {
- id = "/subscriptions/********-****-****-****-************/resourceGroups/TestRG1" -> null
- location = "eastus" -> null
- name = "TestRG1" -> null
- tags = {} -> null
}
# azurerm_subnet.GatewaySubnet will be destroyed
- resource "azurerm_subnet" "GatewaySubnet" {
- address_prefix = "10.1.255.0/27" -> null
- address_prefixes = [
- "10.1.255.0/27",
] -> null
- enforce_private_link_endpoint_network_policies = false -> null
- enforce_private_link_service_network_policies = false -> null
- id = "/subscriptions/********-****-****-****-************/resourceGroups/TestRG1/providers/Microsoft.Network/virtualNetworks/VNet1/subnets/GatewaySubnet" -> null
- name = "GatewaySubnet" -> null
- resource_group_name = "TestRG1" -> null
- service_endpoint_policy_ids = [] -> null
- service_endpoints = [] -> null
- virtual_network_name = "VNet1" -> null
}
# azurerm_virtual_network.VNet1 will be destroyed
- resource "azurerm_virtual_network" "VNet1" {
- address_space = [
- "10.1.0.0/16",
] -> null
- dns_servers = [] -> null
- flow_timeout_in_minutes = 0 -> null
- guid = "a4d0f236-50cd-4597-bbec-126cbc60f4d9" -> null
- id = "/subscriptions/********-****-****-****-************/resourceGroups/TestRG1/providers/Microsoft.Network/virtualNetworks/VNet1" -> null
- location = "eastus" -> null
- name = "VNet1" -> null
- resource_group_name = "TestRG1" -> null
- subnet = [
- {
- address_prefix = "10.1.0.0/24"
- id = "/subscriptions/********-****-****-****-************/resourceGroups/TestRG1/providers/Microsoft.Network/virtualNetworks/VNet1/subnets/Frontend"
- name = "Frontend"
- security_group = ""
},
- {
- address_prefix = "10.1.255.0/27"
- id = "/subscriptions/********-****-****-****-************/resourceGroups/TestRG1/providers/Microsoft.Network/virtualNetworks/VNet1/subnets/GatewaySubnet"
- name = "GatewaySubnet"
- security_group = ""
},
] -> null
- tags = {} -> null
- vm_protection_enabled = false -> null
}
# azurerm_virtual_network_gateway.VNet1GW will be destroyed
- resource "azurerm_virtual_network_gateway" "VNet1GW" {
- active_active = false -> null
- enable_bgp = false -> null
- generation = "Generation1" -> null
- id = "/subscriptions/********-****-****-****-************/resourceGroups/TestRG1/providers/Microsoft.Network/virtualNetworkGateways/VNet1GW" -> null
- location = "eastus" -> null
- name = "VNet1GW" -> null
- private_ip_address_enabled = false -> null
- resource_group_name = "TestRG1" -> null
- sku = "VpnGw1" -> null
- tags = {} -> null
- type = "Vpn" -> null
- vpn_type = "RouteBased" -> null
- bgp_settings {
- asn = 65515 -> null
- peer_weight = 0 -> null
- peering_address = "10.1.255.30" -> null
- peering_addresses {
- apipa_addresses = [] -> null
- default_addresses = [
- "10.1.255.30",
] -> null
- ip_configuration_name = "vnetGatewayConfig" -> null
- tunnel_ip_addresses = [
- "20.232.177.186",
] -> null
}
}
- ip_configuration {
- name = "vnetGatewayConfig" -> null
- private_ip_address_allocation = "Dynamic" -> null
- public_ip_address_id = "/subscriptions/********-****-****-****-************/resourceGroups/TestRG1/providers/Microsoft.Network/publicIPAddresses/VNet1GWIP" -> null
- subnet_id = "/subscriptions/********-****-****-****-************/resourceGroups/TestRG1/providers/Microsoft.Network/virtualNetworks/VNet1/subnets/GatewaySubnet" -> null
}
}
Plan: 0 to add, 0 to change, 5 to destroy.
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Saved the plan to: main.destroy.tfplan
To perform exactly these actions, run the following command to apply:
terraform apply "main.destroy.tfplan"
Destroyプランを適用
コマンド
terraform apply main.destroy.tfplan
出力
[ ~/vgw ]$ terraform apply main.destroy.tfplan
azurerm_resource_group.TestRG1: Destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1]
azurerm_virtual_network_gateway.VNet1GW: Destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1/providers/Microsoft.Network/virtualNetworkGateways/VNet1GW]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 10s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 10s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 20s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 20s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 30s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 30s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 40s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 40s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 50s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 50s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 1m0s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 1m0s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 1m10s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 1m10s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 1m20s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 1m20s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 1m30s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 1m30s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 1m40s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 1m40s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 1m50s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 1m50s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 2m0s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 2m0s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 2m10s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 2m10s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 2m20s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 2m20s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 2m30s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 2m30s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 2m40s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 2m40s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 2m50s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 2m50s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 3m0s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 3m0s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 3m10s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 3m10s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 3m20s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 3m20s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 3m30s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 3m30s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 3m40s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 3m40s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 3m50s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 3m50s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 4m0s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 4m0s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 4m10s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 4m10s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 4m20s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 4m20s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 4m30s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 4m30s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 4m40s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 4m40s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 4m50s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 4m50s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 5m0s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 5m0s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 5m10s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 5m10s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 5m20s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 5m20s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 5m30s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 5m30s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 5m40s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 5m40s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 5m50s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 5m50s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 6m0s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 6m0s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 6m10s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 6m10s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 6m20s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 6m20s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 6m30s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 6m30s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 6m40s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 6m40s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 6m50s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 6m50s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 7m0s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 7m0s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 7m10s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 7m10s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 7m20s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 7m20s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 7m30s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 7m30s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 7m40s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 7m40s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 7m50s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 7m50s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 8m0s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 8m0s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 8m10s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 8m10s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 8m20s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 8m20s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 8m30s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 8m30s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 8m40s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 8m40s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 8m50s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 8m50s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 9m0s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 9m0s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 9m10s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 9m10s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 9m20s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 9m20s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 9m30s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 9m30s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 9m40s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 9m40s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 9m50s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 9m50s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 10m0s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 10m0s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 10m10s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 10m10s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 10m20s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 10m20s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 10m30s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 10m30s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 10m40s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 10m40s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 10m50s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 10m50s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 11m0s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 11m0s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 11m10s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 11m10s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 11m20s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 11m20s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 11m30s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 11m30s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 11m40s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 11m40s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 11m50s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 11m50s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 12m0s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 12m0s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 12m10s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 12m10s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 12m20s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 12m20s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 12m30s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 12m30s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 12m40s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 12m40s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 12m50s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 12m50s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 13m0s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 13m0s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 13m10s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 13m10s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 13m20s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 13m20s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 13m30s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 13m30s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 13m40s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 13m40s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 13m50s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 13m50s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Still destroying... [id=/subscriptions/********-****-****-****-...Network/virtualNetworkGateways/VNet1GW, 14m0s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 14m0s elapsed]
azurerm_virtual_network_gateway.VNet1GW: Destruction complete after 14m10s
azurerm_subnet.GatewaySubnet: Destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1/providers/Microsoft.Network/virtualNetworks/VNet1/subnets/GatewaySubnet]
azurerm_public_ip.VNet1GWIP: Destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1/providers/Microsoft.Network/publicIPAddresses/VNet1GWIP]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 14m10s elapsed]
azurerm_subnet.GatewaySubnet: Destruction complete after 0s
azurerm_virtual_network.VNet1: Destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1/providers/Microsoft.Network/virtualNetworks/VNet1]
azurerm_virtual_network.VNet1: Destruction complete after 7s
azurerm_public_ip.VNet1GWIP: Still destroying... [id=/subscriptions/********-****-****-****-...ft.Network/publicIPAddresses/VNet1GWIP, 10s elapsed]
azurerm_public_ip.VNet1GWIP: Destruction complete after 10s
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 14m20s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 14m30s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 14m40s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 14m50s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 15m0s elapsed]
azurerm_resource_group.TestRG1: Still destroying... [id=/subscriptions/********-****-****-****-************/resourceGroups/TestRG1, 15m10s elapsed]
azurerm_resource_group.TestRG1: Destruction complete after 15m19s
Apply complete! Resources: 0 added, 0 changed, 5 destroyed.
確認
コマンド
terraform show
出力
[ ~/vgw ]$ terraform show
The state file is empty. No resources are represented.