使用Terraform创建OCI的VCN
首先
继上次之后,参考OCI手册,使用Terraform创建VCN。
创建Terraform配置文件
验证
我们将直接使用之前创建的provider.tf文件。
provider "oci" {
tenancy_ocid = "<tenancy-ocid>"
user_ocid = "<user-ocid>"
private_key_path = "<rsa-private-key-path>"
fingerprint = "<fingerprint>"
region = "<region-identifier>"
}
terraform {
required_providers {
oci = {
source = "oracle/oci"
}
}
}
数据源
点击Terraform Registry的浏览模块,从提供商中选择Oracle进行勾选。再从模块中选择oracle-terraform-modules/vcn进行点击。

将Provision Instructions的代码复制并创建vcn-module.tf文件。
module "vcn" {
source = "oracle-terraform-modules/vcn/oci"
version = "3.5.5"
# insert the 1 required variable here
}
因为有一个必须的项目,所以请点击”Inputs”进行确认。

一共有22个项目,在其中一个是必需的compartment_id。
如果不指定选项输入,则会设置默认值。
这次除了 compartment_id,我们还设置了5个可选项。
module "vcn" {
source = "oracle-terraform-modules/vcn/oci"
version = "3.5.5"
# insert the 1 required variable here
compartment_id = "<compartment-ocid>"
# Optional Inputs
create_internet_gateway = "true"
create_nat_gateway = "true"
create_service_gateway = "true"
region = "<region-identifier>"
vcn_name = "tf-vcn"
}
工作力量
点击oracle-terraform-modules/vcn的输出,确认可在Output中使用的属性。

这次按照手册的说明进行了操作,创建了以下的文件。
output "vcn_id" {
description = "OCID of the VCN that is created"
value = module.vcn.vcn_id
}
output "id-for-route-table-that-includes-the-internet-gateway" {
description = "OCID of the internet-route table. This route table has an internet gateway to be used for public subnets"
value = module.vcn.ig_route_id
}
output "nat-gateway-id" {
description = "OCID for NAT gateway"
value = module.vcn.nat_gateway_id
}
output "id-for-for-route-table-that-includes-the-nat-gateway" {
description = "OCID of the nat-route table - This route table has a nat gateway to be used for private subnets. This route table also has a service gateway."
value = module.vcn.nat_route_id
}
項目説明output出力結果とともに表示されるラベルを設定descriptionコードブロックの説明(オプション)valuemodule.<vcn-module.tfで指定したモジュール名>.<属性名>
我创建了以下三个文件作为设置文件。
$ ls -l tf-vcn/
total 36
-rw-rw-r--. 1 opc opc 683 Nov 2 04:45 outputs.tf
-rw-rw-r--. 1 opc opc 445 Nov 1 23:43 provider.tf
-rw-rw-r--. 1 opc opc 396 Nov 2 04:13 vcn-module.tf
部署 Terraform
开始
$ terraform init
Initializing the backend...
Initializing modules...
Downloading registry.terraform.io/oracle-terraform-modules/vcn/oci 3.5.5 for vcn...
- vcn in .terraform/modules/vcn
- vcn.subnet in .terraform/modules/vcn/modules/subnet
Initializing provider plugins...
- Finding oracle/oci versions matching ">= 4.67.3"...
- Installing oracle/oci v5.19.0...
- Installed oracle/oci v5.19.0 (signed by a HashiCorp partner, key ID 1533A49284137CEB)
Partner and community providers are signed by their developers.
If you'd like to know more about provider signing, you can read about it here:
https://www.terraform.io/docs/cli/plugins/signing.html
Terraform has created a lock file .terraform.lock.hcl to record the provider
selections it made above. Include this file in your version control repository
so that Terraform can guarantee to make the same selections by default when
you run "terraform init" in the future.
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
module.vcn.data.oci_core_services.all_oci_services[0]: Reading...
module.vcn.data.oci_core_services.all_oci_services[0]: Read complete after 0s [id=CoreServicesDataSource-0]
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:
# module.vcn.oci_core_default_security_list.lockdown[0] will be created
+ resource "oci_core_default_security_list" "lockdown" {
+ compartment_id = (known after apply)
+ defined_tags = (known after apply)
+ display_name = (known after apply)
+ freeform_tags = (known after apply)
+ id = (known after apply)
+ manage_default_resource_id = (known after apply)
+ state = (known after apply)
+ time_created = (known after apply)
}
# module.vcn.oci_core_internet_gateway.ig[0] will be created
+ resource "oci_core_internet_gateway" "ig" {
+ compartment_id = "ocid1.compartment.oc1..aaaaaaaamyemvazvbgl42f5pi7gzlpgq5tcmxlipjm2uitoihfschylliy5a"
+ defined_tags = (known after apply)
+ display_name = "internet-gateway"
+ enabled = true
+ freeform_tags = {
+ "module" = "oracle-terraform-modules/vcn/oci"
+ "terraformed" = "Please do not edit manually"
}
+ id = (known after apply)
+ route_table_id = (known after apply)
+ state = (known after apply)
+ time_created = (known after apply)
+ vcn_id = (known after apply)
}
# module.vcn.oci_core_nat_gateway.nat_gateway[0] will be created
+ resource "oci_core_nat_gateway" "nat_gateway" {
+ block_traffic = (known after apply)
+ compartment_id = "ocid1.compartment.oc1..aaaaaaaamyemvazvbgl42f5pi7gzlpgq5tcmxlipjm2uitoihfschylliy5a"
+ defined_tags = (known after apply)
+ display_name = "nat-gateway"
+ freeform_tags = {
+ "module" = "oracle-terraform-modules/vcn/oci"
+ "terraformed" = "Please do not edit manually"
}
+ id = (known after apply)
+ nat_ip = (known after apply)
+ public_ip_id = (known after apply)
+ route_table_id = (known after apply)
+ state = (known after apply)
+ time_created = (known after apply)
+ vcn_id = (known after apply)
}
# module.vcn.oci_core_route_table.ig[0] will be created
+ resource "oci_core_route_table" "ig" {
+ compartment_id = "ocid1.compartment.oc1..aaaaaaaamyemvazvbgl42f5pi7gzlpgq5tcmxlipjm2uitoihfschylliy5a"
+ defined_tags = (known after apply)
+ display_name = "internet-route"
+ freeform_tags = {
+ "module" = "oracle-terraform-modules/vcn/oci"
+ "terraformed" = "Please do not edit manually"
}
+ id = (known after apply)
+ state = (known after apply)
+ time_created = (known after apply)
+ vcn_id = (known after apply)
+ route_rules {
+ cidr_block = (known after apply)
+ description = "Terraformed - Auto-generated at Internet Gateway creation: Internet Gateway as default gateway"
+ destination = "0.0.0.0/0"
+ destination_type = (known after apply)
+ network_entity_id = (known after apply)
+ route_type = (known after apply)
}
}
# module.vcn.oci_core_route_table.nat[0] will be created
+ resource "oci_core_route_table" "nat" {
+ compartment_id = "ocid1.compartment.oc1..aaaaaaaamyemvazvbgl42f5pi7gzlpgq5tcmxlipjm2uitoihfschylliy5a"
+ defined_tags = (known after apply)
+ display_name = "nat-route"
+ freeform_tags = {
+ "module" = "oracle-terraform-modules/vcn/oci"
+ "terraformed" = "Please do not edit manually"
}
+ id = (known after apply)
+ state = (known after apply)
+ time_created = (known after apply)
+ vcn_id = (known after apply)
+ route_rules {
+ cidr_block = (known after apply)
+ description = "Terraformed - Auto-generated at NAT Gateway creation: NAT Gateway as default gateway"
+ destination = "0.0.0.0/0"
+ destination_type = "CIDR_BLOCK"
+ network_entity_id = (known after apply)
+ route_type = (known after apply)
}
+ route_rules {
+ cidr_block = (known after apply)
+ description = "Terraformed - Auto-generated at Service Gateway creation: All Services in region to Service Gateway"
+ destination = "all-syd-services-in-oracle-services-network"
+ destination_type = "SERVICE_CIDR_BLOCK"
+ network_entity_id = (known after apply)
+ route_type = (known after apply)
}
}
# module.vcn.oci_core_route_table.service_gw[0] will be created
+ resource "oci_core_route_table" "service_gw" {
+ compartment_id = "ocid1.compartment.oc1..aaaaaaaamyemvazvbgl42f5pi7gzlpgq5tcmxlipjm2uitoihfschylliy5a"
+ defined_tags = (known after apply)
+ display_name = "service-gw-route"
+ freeform_tags = {
+ "module" = "oracle-terraform-modules/vcn/oci"
+ "terraformed" = "Please do not edit manually"
}
+ id = (known after apply)
+ state = (known after apply)
+ time_created = (known after apply)
+ vcn_id = (known after apply)
+ route_rules {
+ cidr_block = (known after apply)
+ description = "Terraformed - Auto-generated at Service Gateway creation: All Services in region to Service Gateway"
+ destination = "all-syd-services-in-oracle-services-network"
+ destination_type = "SERVICE_CIDR_BLOCK"
+ network_entity_id = (known after apply)
+ route_type = (known after apply)
}
}
# module.vcn.oci_core_service_gateway.service_gateway[0] will be created
+ resource "oci_core_service_gateway" "service_gateway" {
+ block_traffic = (known after apply)
+ compartment_id = "ocid1.compartment.oc1..aaaaaaaamyemvazvbgl42f5pi7gzlpgq5tcmxlipjm2uitoihfschylliy5a"
+ defined_tags = (known after apply)
+ display_name = "service-gateway"
+ freeform_tags = {
+ "module" = "oracle-terraform-modules/vcn/oci"
+ "terraformed" = "Please do not edit manually"
}
+ id = (known after apply)
+ route_table_id = (known after apply)
+ state = (known after apply)
+ time_created = (known after apply)
+ vcn_id = (known after apply)
+ services {
+ service_id = "ocid1.service.oc1.ap-sydney-1.aaaaaaaaar6xfo4rtfjgv2mmjvo7u77zyr4uyqkc764f2t2jxwwayrjhsjyq"
+ service_name = (known after apply)
}
}
# module.vcn.oci_core_vcn.vcn will be created
+ resource "oci_core_vcn" "vcn" {
+ byoipv6cidr_blocks = (known after apply)
+ cidr_block = (known after apply)
+ cidr_blocks = [
+ "10.0.0.0/16",
]
+ compartment_id = "ocid1.compartment.oc1..aaaaaaaamyemvazvbgl42f5pi7gzlpgq5tcmxlipjm2uitoihfschylliy5a"
+ default_dhcp_options_id = (known after apply)
+ default_route_table_id = (known after apply)
+ default_security_list_id = (known after apply)
+ defined_tags = (known after apply)
+ display_name = "tf-vcn"
+ dns_label = "vcnmodule"
+ freeform_tags = {
+ "module" = "oracle-terraform-modules/vcn/oci"
+ "terraformed" = "Please do not edit manually"
}
+ id = (known after apply)
+ ipv6cidr_blocks = (known after apply)
+ ipv6private_cidr_blocks = (known after apply)
+ is_ipv6enabled = false
+ is_oracle_gua_allocation_enabled = (known after apply)
+ state = (known after apply)
+ time_created = (known after apply)
+ vcn_domain_name = (known after apply)
}
Plan: 8 to add, 0 to change, 0 to destroy.
Changes to Outputs:
+ id-for-for-route-table-that-includes-the-nat-gateway = (known after apply)
+ id-for-route-table-that-includes-the-internet-gateway = (known after apply)
+ nat-gateway-id = (known after apply)
+ vcn_id = (known after apply)
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Note: You didn't use the -out option to save this plan, so Terraform can't guarantee to take exactly these actions if you run "terraform apply" now.
显示将创建8个资源。计划:添加8个,更改0个,销毁0个。
申请
$ terraform apply
module.vcn.data.oci_core_services.all_oci_services[0]: Reading...
module.vcn.data.oci_core_services.all_oci_services[0]: Read complete after 0s [id=CoreServicesDataSource-0]
・・・省略
Enter a value: yes
module.vcn.oci_core_vcn.vcn: Creating...
module.vcn.oci_core_vcn.vcn: Creation complete after 1s [id=ocid1.vcn.oc1.ap-sydney-1.amaaaaaassl65iqazo5qhz2shgicdn6gwg3o7w4rpq6wz33ywwae3urf3mcq]
module.vcn.oci_core_nat_gateway.nat_gateway[0]: Creating...
module.vcn.oci_core_default_security_list.lockdown[0]: Creating...
module.vcn.oci_core_service_gateway.service_gateway[0]: Creating...
module.vcn.oci_core_internet_gateway.ig[0]: Creating...
module.vcn.oci_core_default_security_list.lockdown[0]: Creation complete after 0s [id=ocid1.securitylist.oc1.ap-sydney-1.aaaaaaaartfegwvjgunoyog3nnrzibrn7yhtlsb5pbvufwv7g73tmj7ahdeq]
module.vcn.oci_core_internet_gateway.ig[0]: Creation complete after 0s [id=ocid1.internetgateway.oc1.ap-sydney-1.aaaaaaaaaj2chi3wsveij5mtotea3okp2z5y2ftagcaja6w6w56uzu5dpaba]
module.vcn.oci_core_route_table.ig[0]: Creating...
module.vcn.oci_core_service_gateway.service_gateway[0]: Creation complete after 0s [id=ocid1.servicegateway.oc1.ap-sydney-1.aaaaaaaaozxajdil4hq63tdga5slf7atzmjru6ochuq6e5pfk3phpilnh3dq]
module.vcn.oci_core_route_table.service_gw[0]: Creating...
module.vcn.oci_core_route_table.ig[0]: Creation complete after 1s [id=ocid1.routetable.oc1.ap-sydney-1.aaaaaaaajajvq5h5ccgk2jzpfysr2pkxxfdlmttet53awvplxv5hiyns2t6a]
module.vcn.oci_core_route_table.service_gw[0]: Creation complete after 1s [id=ocid1.routetable.oc1.ap-sydney-1.aaaaaaaafgedj7y5bimpsr72v3fvmeqcr5sigodg2oy4v3wlhhdc2xrn5rxq]
module.vcn.oci_core_nat_gateway.nat_gateway[0]: Creation complete after 2s [id=ocid1.natgateway.oc1.ap-sydney-1.aaaaaaaaz6me23hdnjmm6wwj5jzvzrdzyixzudrcw7wz4aj7xx3d6w2jn5bq]
module.vcn.oci_core_route_table.nat[0]: Creating...
module.vcn.oci_core_route_table.nat[0]: Creation complete after 0s [id=ocid1.routetable.oc1.ap-sydney-1.aaaaaaaasn7xtu4k6ohuiysnlksircrvyfz3d55g7yxuy6bj4e4bhbrw3raq]
Apply complete! Resources: 8 added, 0 changed, 0 destroyed.
Outputs:
id-for-for-route-table-that-includes-the-nat-gateway = "ocid1.routetable.oc1.ap-sydney-1.aaaaaaaasn7xtu4k6ohuiysnlksircrvyfz3d55g7yxuy6bj4e4bhbrw3raq"
id-for-route-table-that-includes-the-internet-gateway = "ocid1.routetable.oc1.ap-sydney-1.aaaaaaaajajvq5h5ccgk2jzpfysr2pkxxfdlmttet53awvplxv5hiyns2t6a"
nat-gateway-id = "ocid1.natgateway.oc1.ap-sydney-1.aaaaaaaaz6me23hdnjmm6wwj5jzvzrdzyixzudrcw7wz4aj7xx3d6w2jn5bq"
vcn_id = "ocid1.vcn.oc1.ap-sydney-1.amaaaaaassl65iqazo5qhz2shgicdn6gwg3o7w4rpq6wz33ywwae3urf3mcq"
我們將在 OCI 控制台中確認是否已經創建。

摧毁
$ terraform destroy
module.vcn.data.oci_core_services.all_oci_services[0]: Reading...
module.vcn.oci_core_vcn.vcn: Refreshing state... [id=ocid1.vcn.oc1.ap-sydney-1.amaaaaaassl65iqazo5qhz2shgicdn6gwg3o7w4rpq6wz33ywwae3urf3mcq]
module.vcn.data.oci_core_services.all_oci_services[0]: Read complete after 0s [id=CoreServicesDataSource-0]
module.vcn.oci_core_internet_gateway.ig[0]: Refreshing state... [id=ocid1.internetgateway.oc1.ap-sydney-1.aaaaaaaaaj2chi3wsveij5mtotea3okp2z5y2ftagcaja6w6w56uzu5dpaba]
module.vcn.oci_core_default_security_list.lockdown[0]: Refreshing state... [id=ocid1.securitylist.oc1.ap-sydney-1.aaaaaaaartfegwvjgunoyog3nnrzibrn7yhtlsb5pbvufwv7g73tmj7ahdeq]
module.vcn.oci_core_nat_gateway.nat_gateway[0]: Refreshing state... [id=ocid1.natgateway.oc1.ap-sydney-1.aaaaaaaaz6me23hdnjmm6wwj5jzvzrdzyixzudrcw7wz4aj7xx3d6w2jn5bq]
module.vcn.oci_core_service_gateway.service_gateway[0]: Refreshing state... [id=ocid1.servicegateway.oc1.ap-sydney-1.aaaaaaaaozxajdil4hq63tdga5slf7atzmjru6ochuq6e5pfk3phpilnh3dq]
module.vcn.oci_core_route_table.ig[0]: Refreshing state... [id=ocid1.routetable.oc1.ap-sydney-1.aaaaaaaajajvq5h5ccgk2jzpfysr2pkxxfdlmttet53awvplxv5hiyns2t6a]
module.vcn.oci_core_route_table.service_gw[0]: Refreshing state... [id=ocid1.routetable.oc1.ap-sydney-1.aaaaaaaafgedj7y5bimpsr72v3fvmeqcr5sigodg2oy4v3wlhhdc2xrn5rxq]
module.vcn.oci_core_route_table.nat[0]: Refreshing state... [id=ocid1.routetable.oc1.ap-sydney-1.aaaaaaaasn7xtu4k6ohuiysnlksircrvyfz3d55g7yxuy6bj4e4bhbrw3raq]
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:
# module.vcn.oci_core_default_security_list.lockdown[0] will be destroyed
- resource "oci_core_default_security_list" "lockdown" {
- compartment_id = "ocid1.compartment.oc1..aaaaaaaamyemvazvbgl42f5pi7gzlpgq5tcmxlipjm2uitoihfschylliy5a" -> null
- defined_tags = {} -> null
- display_name = "Default Security List for tf-vcn" -> null
- freeform_tags = {
- "module" = "oracle-terraform-modules/vcn/oci"
- "terraformed" = "Please do not edit manually"
} -> null
- id = "ocid1.securitylist.oc1.ap-sydney-1.aaaaaaaartfegwvjgunoyog3nnrzibrn7yhtlsb5pbvufwv7g73tmj7ahdeq" -> null
- manage_default_resource_id = "ocid1.securitylist.oc1.ap-sydney-1.aaaaaaaartfegwvjgunoyog3nnrzibrn7yhtlsb5pbvufwv7g73tmj7ahdeq" -> null
- state = "AVAILABLE" -> null
- time_created = "2023-11-02 04:48:53.411 +0000 UTC" -> null
}
# module.vcn.oci_core_internet_gateway.ig[0] will be destroyed
- resource "oci_core_internet_gateway" "ig" {
- compartment_id = "ocid1.compartment.oc1..aaaaaaaamyemvazvbgl42f5pi7gzlpgq5tcmxlipjm2uitoihfschylliy5a" -> null
- defined_tags = {} -> null
- display_name = "internet-gateway" -> null
- enabled = true -> null
- freeform_tags = {
- "module" = "oracle-terraform-modules/vcn/oci"
- "terraformed" = "Please do not edit manually"
} -> null
- id = "ocid1.internetgateway.oc1.ap-sydney-1.aaaaaaaaaj2chi3wsveij5mtotea3okp2z5y2ftagcaja6w6w56uzu5dpaba" -> null
- state = "AVAILABLE" -> null
- time_created = "2023-11-02 04:48:53.886 +0000 UTC" -> null
- vcn_id = "ocid1.vcn.oc1.ap-sydney-1.amaaaaaassl65iqazo5qhz2shgicdn6gwg3o7w4rpq6wz33ywwae3urf3mcq" -> null
}
# module.vcn.oci_core_nat_gateway.nat_gateway[0] will be destroyed
- resource "oci_core_nat_gateway" "nat_gateway" {
- block_traffic = false -> null
- compartment_id = "ocid1.compartment.oc1..aaaaaaaamyemvazvbgl42f5pi7gzlpgq5tcmxlipjm2uitoihfschylliy5a" -> null
- defined_tags = {} -> null
- display_name = "nat-gateway" -> null
- freeform_tags = {
- "module" = "oracle-terraform-modules/vcn/oci"
- "terraformed" = "Please do not edit manually"
} -> null
- id = "ocid1.natgateway.oc1.ap-sydney-1.aaaaaaaaz6me23hdnjmm6wwj5jzvzrdzyixzudrcw7wz4aj7xx3d6w2jn5bq" -> null
- nat_ip = "192.9.169.223" -> null
- public_ip_id = "ocid1.publicip.oc1.ap-sydney-1.aaaaaaaatq4s5k2mkxiiwd5dbmz2b3tjixkilrp6uuabdigy3rcsksp76iuq" -> null
- state = "AVAILABLE" -> null
- time_created = "2023-11-02 04:48:54.688 +0000 UTC" -> null
- vcn_id = "ocid1.vcn.oc1.ap-sydney-1.amaaaaaassl65iqazo5qhz2shgicdn6gwg3o7w4rpq6wz33ywwae3urf3mcq" -> null
}
# module.vcn.oci_core_route_table.ig[0] will be destroyed
- resource "oci_core_route_table" "ig" {
- compartment_id = "ocid1.compartment.oc1..aaaaaaaamyemvazvbgl42f5pi7gzlpgq5tcmxlipjm2uitoihfschylliy5a" -> null
- defined_tags = {} -> null
- display_name = "internet-route" -> null
- freeform_tags = {
- "module" = "oracle-terraform-modules/vcn/oci"
- "terraformed" = "Please do not edit manually"
} -> null
- id = "ocid1.routetable.oc1.ap-sydney-1.aaaaaaaajajvq5h5ccgk2jzpfysr2pkxxfdlmttet53awvplxv5hiyns2t6a" -> null
- state = "AVAILABLE" -> null
- time_created = "2023-11-02 04:48:54.295 +0000 UTC" -> null
- vcn_id = "ocid1.vcn.oc1.ap-sydney-1.amaaaaaassl65iqazo5qhz2shgicdn6gwg3o7w4rpq6wz33ywwae3urf3mcq" -> null
- route_rules {
- description = "Terraformed - Auto-generated at Internet Gateway creation: Internet Gateway as default gateway" -> null
- destination = "0.0.0.0/0" -> null
- destination_type = "CIDR_BLOCK" -> null
- network_entity_id = "ocid1.internetgateway.oc1.ap-sydney-1.aaaaaaaaaj2chi3wsveij5mtotea3okp2z5y2ftagcaja6w6w56uzu5dpaba" -> null
}
}
# module.vcn.oci_core_route_table.nat[0] will be destroyed
- resource "oci_core_route_table" "nat" {
- compartment_id = "ocid1.compartment.oc1..aaaaaaaamyemvazvbgl42f5pi7gzlpgq5tcmxlipjm2uitoihfschylliy5a" -> null
- defined_tags = {} -> null
- display_name = "nat-route" -> null
- freeform_tags = {
- "module" = "oracle-terraform-modules/vcn/oci"
- "terraformed" = "Please do not edit manually"
} -> null
- id = "ocid1.routetable.oc1.ap-sydney-1.aaaaaaaasn7xtu4k6ohuiysnlksircrvyfz3d55g7yxuy6bj4e4bhbrw3raq" -> null
- state = "AVAILABLE" -> null
- time_created = "2023-11-02 04:48:55.695 +0000 UTC" -> null
- vcn_id = "ocid1.vcn.oc1.ap-sydney-1.amaaaaaassl65iqazo5qhz2shgicdn6gwg3o7w4rpq6wz33ywwae3urf3mcq" -> null
- route_rules {
- description = "Terraformed - Auto-generated at NAT Gateway creation: NAT Gateway as default gateway" -> null
- destination = "0.0.0.0/0" -> null
- destination_type = "CIDR_BLOCK" -> null
- network_entity_id = "ocid1.natgateway.oc1.ap-sydney-1.aaaaaaaaz6me23hdnjmm6wwj5jzvzrdzyixzudrcw7wz4aj7xx3d6w2jn5bq" -> null
}
- route_rules {
- description = "Terraformed - Auto-generated at Service Gateway creation: All Services in region to Service Gateway" -> null
- destination = "all-syd-services-in-oracle-services-network" -> null
- destination_type = "SERVICE_CIDR_BLOCK" -> null
- network_entity_id = "ocid1.servicegateway.oc1.ap-sydney-1.aaaaaaaaozxajdil4hq63tdga5slf7atzmjru6ochuq6e5pfk3phpilnh3dq" -> null
}
}
# module.vcn.oci_core_route_table.service_gw[0] will be destroyed
- resource "oci_core_route_table" "service_gw" {
- compartment_id = "ocid1.compartment.oc1..aaaaaaaamyemvazvbgl42f5pi7gzlpgq5tcmxlipjm2uitoihfschylliy5a" -> null
- defined_tags = {} -> null
- display_name = "service-gw-route" -> null
- freeform_tags = {
- "module" = "oracle-terraform-modules/vcn/oci"
- "terraformed" = "Please do not edit manually"
} -> null
- id = "ocid1.routetable.oc1.ap-sydney-1.aaaaaaaafgedj7y5bimpsr72v3fvmeqcr5sigodg2oy4v3wlhhdc2xrn5rxq" -> null
- state = "AVAILABLE" -> null
- time_created = "2023-11-02 04:48:54.605 +0000 UTC" -> null
- vcn_id = "ocid1.vcn.oc1.ap-sydney-1.amaaaaaassl65iqazo5qhz2shgicdn6gwg3o7w4rpq6wz33ywwae3urf3mcq" -> null
- route_rules {
- description = "Terraformed - Auto-generated at Service Gateway creation: All Services in region to Service Gateway" -> null
- destination = "all-syd-services-in-oracle-services-network" -> null
- destination_type = "SERVICE_CIDR_BLOCK" -> null
- network_entity_id = "ocid1.servicegateway.oc1.ap-sydney-1.aaaaaaaaozxajdil4hq63tdga5slf7atzmjru6ochuq6e5pfk3phpilnh3dq" -> null
}
}
# module.vcn.oci_core_service_gateway.service_gateway[0] will be destroyed
- resource "oci_core_service_gateway" "service_gateway" {
- block_traffic = false -> null
- compartment_id = "ocid1.compartment.oc1..aaaaaaaamyemvazvbgl42f5pi7gzlpgq5tcmxlipjm2uitoihfschylliy5a" -> null
- defined_tags = {} -> null
- display_name = "service-gateway" -> null
- freeform_tags = {
- "module" = "oracle-terraform-modules/vcn/oci"
- "terraformed" = "Please do not edit manually"
} -> null
- id = "ocid1.servicegateway.oc1.ap-sydney-1.aaaaaaaaozxajdil4hq63tdga5slf7atzmjru6ochuq6e5pfk3phpilnh3dq" -> null
- state = "AVAILABLE" -> null
- time_created = "2023-11-02 04:48:54.207 +0000 UTC" -> null
- vcn_id = "ocid1.vcn.oc1.ap-sydney-1.amaaaaaassl65iqazo5qhz2shgicdn6gwg3o7w4rpq6wz33ywwae3urf3mcq" -> null
- services {
- service_id = "ocid1.service.oc1.ap-sydney-1.aaaaaaaaar6xfo4rtfjgv2mmjvo7u77zyr4uyqkc764f2t2jxwwayrjhsjyq" -> null
- service_name = "All SYD Services In Oracle Services Network" -> null
}
}
# module.vcn.oci_core_vcn.vcn will be destroyed
- resource "oci_core_vcn" "vcn" {
- byoipv6cidr_blocks = [] -> null
- cidr_block = "10.0.0.0/16" -> null
- cidr_blocks = [
- "10.0.0.0/16",
] -> null
- compartment_id = "ocid1.compartment.oc1..aaaaaaaamyemvazvbgl42f5pi7gzlpgq5tcmxlipjm2uitoihfschylliy5a" -> null
- default_dhcp_options_id = "ocid1.dhcpoptions.oc1.ap-sydney-1.aaaaaaaa4i6ywheqswdfkrywbpfxkjegj2werbwrlzqbaoiflultcgw3ei2q" -> null
- default_route_table_id = "ocid1.routetable.oc1.ap-sydney-1.aaaaaaaa754k24pavx7xoev4jw5xgqkkqcijg6rcx5my7fvvyh7rfkthzdhq" -> null
- default_security_list_id = "ocid1.securitylist.oc1.ap-sydney-1.aaaaaaaartfegwvjgunoyog3nnrzibrn7yhtlsb5pbvufwv7g73tmj7ahdeq" -> null
- defined_tags = {} -> null
- display_name = "tf-vcn" -> null
- dns_label = "vcnmodule" -> null
- freeform_tags = {
- "module" = "oracle-terraform-modules/vcn/oci"
- "terraformed" = "Please do not edit manually"
} -> null
- id = "ocid1.vcn.oc1.ap-sydney-1.amaaaaaassl65iqazo5qhz2shgicdn6gwg3o7w4rpq6wz33ywwae3urf3mcq" -> null
- ipv6cidr_blocks = [] -> null
- ipv6private_cidr_blocks = [] -> null
- is_ipv6enabled = false -> null
- state = "AVAILABLE" -> null
- time_created = "2023-11-02 04:48:53.411 +0000 UTC" -> null
- vcn_domain_name = "vcnmodule.oraclevcn.com" -> null
}
Plan: 0 to add, 0 to change, 8 to destroy.
Changes to Outputs:
- id-for-for-route-table-that-includes-the-nat-gateway = "ocid1.routetable.oc1.ap-sydney-1.aaaaaaaasn7xtu4k6ohuiysnlksircrvyfz3d55g7yxuy6bj4e4bhbrw3raq" -> null
- id-for-route-table-that-includes-the-internet-gateway = "ocid1.routetable.oc1.ap-sydney-1.aaaaaaaajajvq5h5ccgk2jzpfysr2pkxxfdlmttet53awvplxv5hiyns2t6a" -> null
- nat-gateway-id = "ocid1.natgateway.oc1.ap-sydney-1.aaaaaaaaz6me23hdnjmm6wwj5jzvzrdzyixzudrcw7wz4aj7xx3d6w2jn5bq" -> null
- vcn_id = "ocid1.vcn.oc1.ap-sydney-1.amaaaaaassl65iqazo5qhz2shgicdn6gwg3o7w4rpq6wz33ywwae3urf3mcq" -> null
Do you really want to destroy all resources?
Terraform will destroy all your managed infrastructure, as shown above.
There is no undo. Only 'yes' will be accepted to confirm.
Enter a value: yes
module.vcn.oci_core_default_security_list.lockdown[0]: Destroying... [id=ocid1.securitylist.oc1.ap-sydney-1.aaaaaaaartfegwvjgunoyog3nnrzibrn7yhtlsb5pbvufwv7g73tmj7ahdeq]
module.vcn.oci_core_route_table.service_gw[0]: Destroying... [id=ocid1.routetable.oc1.ap-sydney-1.aaaaaaaafgedj7y5bimpsr72v3fvmeqcr5sigodg2oy4v3wlhhdc2xrn5rxq]
module.vcn.oci_core_route_table.ig[0]: Destroying... [id=ocid1.routetable.oc1.ap-sydney-1.aaaaaaaajajvq5h5ccgk2jzpfysr2pkxxfdlmttet53awvplxv5hiyns2t6a]
module.vcn.oci_core_route_table.nat[0]: Destroying... [id=ocid1.routetable.oc1.ap-sydney-1.aaaaaaaasn7xtu4k6ohuiysnlksircrvyfz3d55g7yxuy6bj4e4bhbrw3raq]
module.vcn.oci_core_default_security_list.lockdown[0]: Destruction complete after 0s
module.vcn.oci_core_route_table.service_gw[0]: Destruction complete after 0s
module.vcn.oci_core_route_table.nat[0]: Destruction complete after 0s
module.vcn.oci_core_service_gateway.service_gateway[0]: Destroying... [id=ocid1.servicegateway.oc1.ap-sydney-1.aaaaaaaaozxajdil4hq63tdga5slf7atzmjru6ochuq6e5pfk3phpilnh3dq]
module.vcn.oci_core_nat_gateway.nat_gateway[0]: Destroying... [id=ocid1.natgateway.oc1.ap-sydney-1.aaaaaaaaz6me23hdnjmm6wwj5jzvzrdzyixzudrcw7wz4aj7xx3d6w2jn5bq]
module.vcn.oci_core_route_table.ig[0]: Destruction complete after 0s
module.vcn.oci_core_internet_gateway.ig[0]: Destroying... [id=ocid1.internetgateway.oc1.ap-sydney-1.aaaaaaaaaj2chi3wsveij5mtotea3okp2z5y2ftagcaja6w6w56uzu5dpaba]
module.vcn.oci_core_internet_gateway.ig[0]: Destruction complete after 1s
module.vcn.oci_core_nat_gateway.nat_gateway[0]: Destruction complete after 1s
module.vcn.oci_core_service_gateway.service_gateway[0]: Destruction complete after 8s
module.vcn.oci_core_vcn.vcn: Destroying... [id=ocid1.vcn.oc1.ap-sydney-1.amaaaaaassl65iqazo5qhz2shgicdn6gwg3o7w4rpq6wz33ywwae3urf3mcq]
module.vcn.oci_core_vcn.vcn: Destruction complete after 0s
Destroy complete! Resources: 8 destroyed.
每个控制台上都可以确认已被删除。