8i | 9i | 10g | 11g | 12c | 13c | 18c | 19c | 21c | 23ai | Misc | PL/SQL | SQL | RAC | WebLogic | Linux
Terraform : Linking Oracle Cloud Interface (OCI) Terraform Modules Together
This article demonstrates how to link Oracle Cloud Interface (OCI) Terraform modules together to deploy infrastructure.
Related articles.
Introduction
In previous articles we've discussed how to build individual pieces of OCI infrastructure using Terraform.
- Terraform : Oracle Cloud Infrastructure (OCI) Provider
- Terraform : Oracle Cloud Infrastructure (OCI) Compartment
- Terraform : Oracle Cloud Infrastructure (OCI) Virtual Cloud Network (VCN)
- Terraform : Oracle Cloud Infrastructure (OCI) Autonomous Database (ADW, ATP, AJD, APX)
The rest of this article assumes you have worked through these articles and have created the relevant files.
Typically we would expect to create a whole system with a single definition, but that's not quite as simple as combining the above definitions due to dependencies. We may require information about a parent component before we can build the child component. In this article we'll demonstrate this by creating a new compartment, containing a VCN and an autonomous database. Both the VCN and the database need the ID of the compartment before they can be created. In the individual articles we provided this as an input parameter, but we don't know the compartment ID until it's created, so we need to reference the compartment ID in the dependent resources.
Setup
We start by creating a new working directory.
mkdir \git\oraclebase\terraform\oci\oci_full_adb cd \git\oraclebase\terraform\oci\oci_full_adb
We copy in the "*.tf" and "*.tfvars" scripts for the provider and the individual components as our starting point.
copy \git\oraclebase\terraform\oci\oci_provider\*.tf . copy \git\oraclebase\terraform\oci\oci_provider\*.tfvars . copy \git\oraclebase\terraform\oci\oci_compartment\*.tf . copy \git\oraclebase\terraform\oci\oci_compartment\*.tfvars . copy \git\oraclebase\terraform\oci\oci_vcn\*.tf . copy \git\oraclebase\terraform\oci\oci_vcn\*.tfvars . copy \git\oraclebase\terraform\oci\oci_adb\*.tf . copy \git\oraclebase\terraform\oci\oci_adb\*.tfvars .
Now we need to amend the scripts to make sure the dependencies are taken care of. The provider and compartment scripts will work without amendments, as there are no dependencies to worry about.
The outputs in the "oci_compartment.tf" script include the following definition. The text in bold is important because that will return the ID of the compartment once we build it. We can use this in dependent scripts to populate the compartment_id
setting.
output "compartment_id" { value = oci_identity_compartment.tf_compartment.id }
Amend the VCN Files
The VCN is a child of the compartment, so we need to source the ID of the compartment we are building. Edit the "oci_vcn.tf" file. It's a large file, so well describe the changes that need to be made.
Remove the compartment_id
variable definition.
#variable "compartment_id" { type = string }
Set all references to the compartment_id
by referencing the oci_identity_compartment.tf_compartment.id
output variable from the compartment build. There are several references to amend. One for the module, and one for each resource definition.
compartment_id = oci_identity_compartment.tf_compartment.id
We need to remove the compartment_id
setting from the "oci_vcn_variables.auto.tfvars" file.
#compartment_id = "ocid1.compartment.oc1..aaaaaaaa..." vcn_display_name = "obvcn3" vcn_dns_label = "obvcn3"
Amend the Autonomous Database Files
The autonomous database is a child of the compartment, so we need to source the ID of the compartment we are building. Edit the "oci_adb.tf" file. The changes are in bold.
# Variables #variable "compartment_id" { type = string } variable "db_name" { type = string } variable "admin_password" { type = string } variable "db_version" { type = string } # OLTP, DW, AJD, APEX variable "db_workload" { type = string } # Must be false for AJD and APEX variable "is_free_tier" { type = string } # BRING_YOUR_OWN_LICENSE or LICENSE_INCLUDED variable "license_model" { type = string } variable "cpu_core_count" { type = number default = 1 } variable "data_storage_size_in_tbs" { type = number default = 1 } # Resources resource "oci_database_autonomous_database" "tf_adb" { #compartment_id = var.compartment_id compartment_id = oci_identity_compartment.tf_compartment.id cpu_core_count = var.cpu_core_count data_storage_size_in_tbs = var.data_storage_size_in_tbs db_name = var.db_name admin_password = var.admin_password db_version = var.db_version db_workload = var.db_workload display_name = var.db_name is_free_tier = var.is_free_tier license_model = var.license_model } # Outputs output "db_name" { value = oci_database_autonomous_database.tf_adb.display_name } output "db_state" { value = oci_database_autonomous_database.tf_adb.state }
We've removed the compartment_id
input variable, and set the compartment_id
in the resource by referencing the oci_identity_compartment.tf_compartment.id
output variable from the compartment build.
We need to remove the compartment_id
setting from the "oci_adb_variables.auto.tfvars" file.
#compartment_id = "ocid1.compartment.oc1..aaaaaaaa..." db_name = "obadw3" admin_password = "MyStrongPassword123" db_version = "21c" # OLTP, DW, AJD, APEX db_workload = "DW" # Must be false for AJD and APEX is_free_tier = "true" license_model = "LICENSE_INCLUDED"
Build the Infrastructure
Initialize the working directory using the terraform init
command.
terraform init
Use the terraform plan
command to test the execution plan.
terraform plan An execution plan has been generated and is shown below. Resource actions are indicated with the following symbols: + create Terraform will perform the following actions: # oci_core_dhcp_options.tf_dhcp_options will be created + resource "oci_core_dhcp_options" "tf_dhcp_options" { + compartment_id = (known after apply) + defined_tags = (known after apply) + display_name = "default-dhcp-options" + freeform_tags = (known after apply) + id = (known after apply) + state = (known after apply) + time_created = (known after apply) + vcn_id = (known after apply) + options { + custom_dns_servers = [] + search_domain_names = (known after apply) + server_type = "VcnLocalPlusInternet" + type = "DomainNameServer" } } # oci_core_security_list.tf_private_security_list will be created + resource "oci_core_security_list" "tf_private_security_list" { + compartment_id = (known after apply) + defined_tags = (known after apply) + display_name = "security-list-for-private-subnet" + freeform_tags = (known after apply) + id = (known after apply) + state = (known after apply) + time_created = (known after apply) + vcn_id = (known after apply) + egress_security_rules { + description = (known after apply) + destination = "0.0.0.0/0" + destination_type = "CIDR_BLOCK" + protocol = "all" + stateless = false } + ingress_security_rules { + description = (known after apply) + protocol = "1" + source = "10.0.0.0/16" + source_type = "CIDR_BLOCK" + stateless = false + icmp_options { + code = -1 + type = 3 } } + ingress_security_rules { + description = (known after apply) + protocol = "1" + source = "0.0.0.0/0" + source_type = "CIDR_BLOCK" + stateless = false + icmp_options { + code = 4 + type = 3 } } + ingress_security_rules { + description = (known after apply) + protocol = "6" + source = "10.0.0.0/16" + source_type = "CIDR_BLOCK" + stateless = false + tcp_options { + max = 22 + min = 22 } } } # oci_core_security_list.tf_public_security_list will be created + resource "oci_core_security_list" "tf_public_security_list" { + compartment_id = (known after apply) + defined_tags = (known after apply) + display_name = "security-list-for-public-subnet" + freeform_tags = (known after apply) + id = (known after apply) + state = (known after apply) + time_created = (known after apply) + vcn_id = (known after apply) + egress_security_rules { + description = (known after apply) + destination = "0.0.0.0/0" + destination_type = "CIDR_BLOCK" + protocol = "all" + stateless = false } + ingress_security_rules { + description = (known after apply) + protocol = "1" + source = "10.0.0.0/16" + source_type = "CIDR_BLOCK" + stateless = false + icmp_options { + code = -1 + type = 3 } } + ingress_security_rules { + description = (known after apply) + protocol = "1" + source = "0.0.0.0/0" + source_type = "CIDR_BLOCK" + stateless = false + icmp_options { + code = 4 + type = 3 } } + ingress_security_rules { + description = (known after apply) + protocol = "6" + source = "0.0.0.0/0" + source_type = "CIDR_BLOCK" + stateless = false + tcp_options { + max = 1522 + min = 1521 } } + ingress_security_rules { + description = (known after apply) + protocol = "6" + source = "0.0.0.0/0" + source_type = "CIDR_BLOCK" + stateless = false + tcp_options { + max = 22 + min = 22 } } } # oci_core_subnet.tf_vcn_private_subnet will be created + resource "oci_core_subnet" "tf_vcn_private_subnet" { + availability_domain = (known after apply) + cidr_block = "10.0.1.0/24" + compartment_id = (known after apply) + defined_tags = (known after apply) + dhcp_options_id = (known after apply) + display_name = "private-subnet" + dns_label = (known after apply) + freeform_tags = (known after apply) + id = (known after apply) + ipv6cidr_block = (known after apply) + ipv6public_cidr_block = (known after apply) + ipv6virtual_router_ip = (known after apply) + prohibit_public_ip_on_vnic = (known after apply) + route_table_id = (known after apply) + security_list_ids = (known after apply) + state = (known after apply) + subnet_domain_name = (known after apply) + time_created = (known after apply) + vcn_id = (known after apply) + virtual_router_ip = (known after apply) + virtual_router_mac = (known after apply) } # oci_core_subnet.tf_vcn_public_subnet will be created + resource "oci_core_subnet" "tf_vcn_public_subnet" { + availability_domain = (known after apply) + cidr_block = "10.0.0.0/24" + compartment_id = (known after apply) + defined_tags = (known after apply) + dhcp_options_id = (known after apply) + display_name = "public-subnet" + dns_label = (known after apply) + freeform_tags = (known after apply) + id = (known after apply) + ipv6cidr_block = (known after apply) + ipv6public_cidr_block = (known after apply) + ipv6virtual_router_ip = (known after apply) + prohibit_public_ip_on_vnic = (known after apply) + route_table_id = (known after apply) + security_list_ids = (known after apply) + state = (known after apply) + subnet_domain_name = (known after apply) + time_created = (known after apply) + vcn_id = (known after apply) + virtual_router_ip = (known after apply) + virtual_router_mac = (known after apply) } # oci_database_autonomous_database.tf_adb will be created + resource "oci_database_autonomous_database" "tf_adb" { + admin_password = (sensitive value) + apex_details = (known after apply) + are_primary_whitelisted_ips_used = (known after apply) + autonomous_container_database_id = (known after apply) + autonomous_database_backup_id = (known after apply) + autonomous_database_id = (known after apply) + available_upgrade_versions = (known after apply) + backup_config = (known after apply) + clone_type = (known after apply) + compartment_id = (known after apply) + connection_strings = (known after apply) + connection_urls = (known after apply) + cpu_core_count = 1 + data_safe_status = (known after apply) + data_storage_size_in_gb = (known after apply) + data_storage_size_in_tbs = 1 + db_name = "obadw3" + db_version = "21c" + db_workload = "DW" + defined_tags = (known after apply) + display_name = "obadw3" + failed_data_recovery_in_seconds = (known after apply) + freeform_tags = (known after apply) + id = (known after apply) + infrastructure_type = (known after apply) + is_access_control_enabled = (known after apply) + is_auto_scaling_enabled = (known after apply) + is_data_guard_enabled = (known after apply) + is_dedicated = (known after apply) + is_free_tier = true + is_preview = (known after apply) + is_preview_version_with_service_terms_accepted = (known after apply) + is_refreshable_clone = (known after apply) + key_store_id = (known after apply) + key_store_wallet_name = (known after apply) + license_model = "LICENSE_INCLUDED" + lifecycle_details = (known after apply) + nsg_ids = (known after apply) + open_mode = (known after apply) + operations_insights_status = (known after apply) + permission_level = (known after apply) + private_endpoint = (known after apply) + private_endpoint_ip = (known after apply) + private_endpoint_label = (known after apply) + refreshable_mode = (known after apply) + refreshable_status = (known after apply) + role = (known after apply) + service_console_url = (known after apply) + source = (known after apply) + source_id = (known after apply) + standby_db = (known after apply) + standby_whitelisted_ips = (known after apply) + state = (known after apply) + subnet_id = (known after apply) + system_tags = (known after apply) + time_created = (known after apply) + time_deletion_of_free_autonomous_database = (known after apply) + time_maintenance_begin = (known after apply) + time_maintenance_end = (known after apply) + time_of_last_failover = (known after apply) + time_of_last_refresh = (known after apply) + time_of_last_refresh_point = (known after apply) + time_of_last_switchover = (known after apply) + time_of_next_refresh = (known after apply) + time_reclamation_of_free_autonomous_database = (known after apply) + timestamp = (known after apply) + used_data_storage_size_in_tbs = (known after apply) } # oci_identity_compartment.tf_compartment will be created + resource "oci_identity_compartment" "tf_compartment" { + compartment_id = "ocid1.tenancy.oc1..aaaaaaaa..." + defined_tags = (known after apply) + description = "Oracle-Base Compartment 3" + freeform_tags = (known after apply) + id = (known after apply) + inactive_state = (known after apply) + is_accessible = (known after apply) + name = "obcomp3" + 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 = (known after apply) + defined_tags = (known after apply) + display_name = "internet-gateway" + enabled = true + freeform_tags = { + "environment" = "dev" } + 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 = (known after apply) + defined_tags = (known after apply) + display_name = "internet-route" + freeform_tags = { + "environment" = "dev" } + 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 = (known after apply) + destination = "0.0.0.0/0" + destination_type = (known after apply) + network_entity_id = (known after apply) } } # module.vcn.oci_core_vcn.vcn will be created + resource "oci_core_vcn" "vcn" { + cidr_block = "10.0.0.0/16" + cidr_blocks = (known after apply) + compartment_id = (known after apply) + 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 = "obvcn3" + dns_label = "obvcn3" + freeform_tags = { + "environment" = "dev" } + id = (known after apply) + ipv6cidr_block = (known after apply) + ipv6public_cidr_block = (known after apply) + is_ipv6enabled = (known after apply) + state = (known after apply) + time_created = (known after apply) + vcn_domain_name = (known after apply) } Plan: 10 to add, 0 to change, 0 to destroy. Changes to Outputs: + compartment_id = (known after apply) + compartment_name = "obcomp3" + db_name = "obadw3" + db_state = (known after apply) + private_security_list_id = (known after apply) + private_subnet_id = (known after apply) + public_security_list_id = (known after apply) + public_subnet_id = (known after apply) + vcn_id = (known after apply) ------------------------------------------------------------------------ Note: You didn't specify an "-out" parameter to save this plan, so Terraform can't guarantee that exactly these actions will be performed if "terraform apply" is subsequently run.
Use the terraform apply
command to create the OCI infrastructure.
terraform apply An execution plan has been generated and is shown below. Resource actions are indicated with the following symbols: + create Terraform will perform the following actions: # oci_core_dhcp_options.tf_dhcp_options will be created + resource "oci_core_dhcp_options" "tf_dhcp_options" { + compartment_id = (known after apply) + defined_tags = (known after apply) + display_name = "default-dhcp-options" + freeform_tags = (known after apply) + id = (known after apply) + state = (known after apply) + time_created = (known after apply) + vcn_id = (known after apply) + options { + custom_dns_servers = [] + search_domain_names = (known after apply) + server_type = "VcnLocalPlusInternet" + type = "DomainNameServer" } } # oci_core_security_list.tf_private_security_list will be created + resource "oci_core_security_list" "tf_private_security_list" { + compartment_id = (known after apply) + defined_tags = (known after apply) + display_name = "security-list-for-private-subnet" + freeform_tags = (known after apply) + id = (known after apply) + state = (known after apply) + time_created = (known after apply) + vcn_id = (known after apply) + egress_security_rules { + description = (known after apply) + destination = "0.0.0.0/0" + destination_type = "CIDR_BLOCK" + protocol = "all" + stateless = false } + ingress_security_rules { + description = (known after apply) + protocol = "1" + source = "10.0.0.0/16" + source_type = "CIDR_BLOCK" + stateless = false + icmp_options { + code = -1 + type = 3 } } + ingress_security_rules { + description = (known after apply) + protocol = "1" + source = "0.0.0.0/0" + source_type = "CIDR_BLOCK" + stateless = false + icmp_options { + code = 4 + type = 3 } } + ingress_security_rules { + description = (known after apply) + protocol = "6" + source = "10.0.0.0/16" + source_type = "CIDR_BLOCK" + stateless = false + tcp_options { + max = 22 + min = 22 } } } # oci_core_security_list.tf_public_security_list will be created + resource "oci_core_security_list" "tf_public_security_list" { + compartment_id = (known after apply) + defined_tags = (known after apply) + display_name = "security-list-for-public-subnet" + freeform_tags = (known after apply) + id = (known after apply) + state = (known after apply) + time_created = (known after apply) + vcn_id = (known after apply) + egress_security_rules { + description = (known after apply) + destination = "0.0.0.0/0" + destination_type = "CIDR_BLOCK" + protocol = "all" + stateless = false } + ingress_security_rules { + description = (known after apply) + protocol = "1" + source = "10.0.0.0/16" + source_type = "CIDR_BLOCK" + stateless = false + icmp_options { + code = -1 + type = 3 } } + ingress_security_rules { + description = (known after apply) + protocol = "1" + source = "0.0.0.0/0" + source_type = "CIDR_BLOCK" + stateless = false + icmp_options { + code = 4 + type = 3 } } + ingress_security_rules { + description = (known after apply) + protocol = "6" + source = "0.0.0.0/0" + source_type = "CIDR_BLOCK" + stateless = false + tcp_options { + max = 1522 + min = 1521 } } + ingress_security_rules { + description = (known after apply) + protocol = "6" + source = "0.0.0.0/0" + source_type = "CIDR_BLOCK" + stateless = false + tcp_options { + max = 22 + min = 22 } } } # oci_core_subnet.tf_vcn_private_subnet will be created + resource "oci_core_subnet" "tf_vcn_private_subnet" { + availability_domain = (known after apply) + cidr_block = "10.0.1.0/24" + compartment_id = (known after apply) + defined_tags = (known after apply) + dhcp_options_id = (known after apply) + display_name = "private-subnet" + dns_label = (known after apply) + freeform_tags = (known after apply) + id = (known after apply) + ipv6cidr_block = (known after apply) + ipv6public_cidr_block = (known after apply) + ipv6virtual_router_ip = (known after apply) + prohibit_public_ip_on_vnic = (known after apply) + route_table_id = (known after apply) + security_list_ids = (known after apply) + state = (known after apply) + subnet_domain_name = (known after apply) + time_created = (known after apply) + vcn_id = (known after apply) + virtual_router_ip = (known after apply) + virtual_router_mac = (known after apply) } # oci_core_subnet.tf_vcn_public_subnet will be created + resource "oci_core_subnet" "tf_vcn_public_subnet" { + availability_domain = (known after apply) + cidr_block = "10.0.0.0/24" + compartment_id = (known after apply) + defined_tags = (known after apply) + dhcp_options_id = (known after apply) + display_name = "public-subnet" + dns_label = (known after apply) + freeform_tags = (known after apply) + id = (known after apply) + ipv6cidr_block = (known after apply) + ipv6public_cidr_block = (known after apply) + ipv6virtual_router_ip = (known after apply) + prohibit_public_ip_on_vnic = (known after apply) + route_table_id = (known after apply) + security_list_ids = (known after apply) + state = (known after apply) + subnet_domain_name = (known after apply) + time_created = (known after apply) + vcn_id = (known after apply) + virtual_router_ip = (known after apply) + virtual_router_mac = (known after apply) } # oci_database_autonomous_database.tf_adb will be created + resource "oci_database_autonomous_database" "tf_adb" { + admin_password = (sensitive value) + apex_details = (known after apply) + are_primary_whitelisted_ips_used = (known after apply) + autonomous_container_database_id = (known after apply) + autonomous_database_backup_id = (known after apply) + autonomous_database_id = (known after apply) + available_upgrade_versions = (known after apply) + backup_config = (known after apply) + clone_type = (known after apply) + compartment_id = (known after apply) + connection_strings = (known after apply) + connection_urls = (known after apply) + cpu_core_count = 1 + data_safe_status = (known after apply) + data_storage_size_in_gb = (known after apply) + data_storage_size_in_tbs = 1 + db_name = "obadw3" + db_version = "21c" + db_workload = "DW" + defined_tags = (known after apply) + display_name = "obadw3" + failed_data_recovery_in_seconds = (known after apply) + freeform_tags = (known after apply) + id = (known after apply) + infrastructure_type = (known after apply) + is_access_control_enabled = (known after apply) + is_auto_scaling_enabled = (known after apply) + is_data_guard_enabled = (known after apply) + is_dedicated = (known after apply) + is_free_tier = true + is_preview = (known after apply) + is_preview_version_with_service_terms_accepted = (known after apply) + is_refreshable_clone = (known after apply) + key_store_id = (known after apply) + key_store_wallet_name = (known after apply) + license_model = "LICENSE_INCLUDED" + lifecycle_details = (known after apply) + nsg_ids = (known after apply) + open_mode = (known after apply) + operations_insights_status = (known after apply) + permission_level = (known after apply) + private_endpoint = (known after apply) + private_endpoint_ip = (known after apply) + private_endpoint_label = (known after apply) + refreshable_mode = (known after apply) + refreshable_status = (known after apply) + role = (known after apply) + service_console_url = (known after apply) + source = (known after apply) + source_id = (known after apply) + standby_db = (known after apply) + standby_whitelisted_ips = (known after apply) + state = (known after apply) + subnet_id = (known after apply) + system_tags = (known after apply) + time_created = (known after apply) + time_deletion_of_free_autonomous_database = (known after apply) + time_maintenance_begin = (known after apply) + time_maintenance_end = (known after apply) + time_of_last_failover = (known after apply) + time_of_last_refresh = (known after apply) + time_of_last_refresh_point = (known after apply) + time_of_last_switchover = (known after apply) + time_of_next_refresh = (known after apply) + time_reclamation_of_free_autonomous_database = (known after apply) + timestamp = (known after apply) + used_data_storage_size_in_tbs = (known after apply) } # oci_identity_compartment.tf_compartment will be created + resource "oci_identity_compartment" "tf_compartment" { + compartment_id = "ocid1.tenancy.oc1..aaaaaaaa..." + defined_tags = (known after apply) + description = "Oracle-Base Compartment 3" + freeform_tags = (known after apply) + id = (known after apply) + inactive_state = (known after apply) + is_accessible = (known after apply) + name = "obcomp3" + 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 = (known after apply) + defined_tags = (known after apply) + display_name = "internet-gateway" + enabled = true + freeform_tags = { + "environment" = "dev" } + 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 = (known after apply) + defined_tags = (known after apply) + display_name = "internet-route" + freeform_tags = { + "environment" = "dev" } + 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 = (known after apply) + destination = "0.0.0.0/0" + destination_type = (known after apply) + network_entity_id = (known after apply) } } # module.vcn.oci_core_vcn.vcn will be created + resource "oci_core_vcn" "vcn" { + cidr_block = "10.0.0.0/16" + cidr_blocks = (known after apply) + compartment_id = (known after apply) + 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 = "obvcn3" + dns_label = "obvcn3" + freeform_tags = { + "environment" = "dev" } + id = (known after apply) + ipv6cidr_block = (known after apply) + ipv6public_cidr_block = (known after apply) + is_ipv6enabled = (known after apply) + state = (known after apply) + time_created = (known after apply) + vcn_domain_name = (known after apply) } Plan: 10 to add, 0 to change, 0 to destroy. Changes to Outputs: + compartment_id = (known after apply) + compartment_name = "obcomp3" + db_name = "obadw3" + db_state = (known after apply) + private_security_list_id = (known after apply) + private_subnet_id = (known after apply) + public_security_list_id = (known after apply) + public_subnet_id = (known after apply) + vcn_id = (known after apply) Do you want to perform these actions? Terraform will perform the actions described above. Only 'yes' will be accepted to approve. Enter a value: yes oci_identity_compartment.tf_compartment: Creating... oci_identity_compartment.tf_compartment: Still creating... [10s elapsed] oci_identity_compartment.tf_compartment: Still creating... [20s elapsed] oci_identity_compartment.tf_compartment: Still creating... [30s elapsed] oci_identity_compartment.tf_compartment: Still creating... [40s elapsed] oci_identity_compartment.tf_compartment: Still creating... [50s elapsed] oci_identity_compartment.tf_compartment: Still creating... [1m0s elapsed] oci_identity_compartment.tf_compartment: Still creating... [1m11s elapsed] oci_identity_compartment.tf_compartment: Creation complete after 1m16s [id=ocid1.compartment.oc1..aaaaaaaa...] module.vcn.oci_core_vcn.vcn: Creating... oci_database_autonomous_database.tf_adb: Creating... module.vcn.oci_core_vcn.vcn: Creation complete after 1s [id=ocid1.vcn.oc1.uk-london-1.amaaaaaa...] module.vcn.oci_core_internet_gateway.ig[0]: Creating... oci_core_dhcp_options.tf_dhcp_options: Creating... oci_core_security_list.tf_private_security_list: Creating... oci_core_security_list.tf_public_security_list: Creating... module.vcn.oci_core_internet_gateway.ig[0]: Creation complete after 0s [id=ocid1.internetgateway.oc1.uk-london-1.aaaaaaaa...] module.vcn.oci_core_route_table.ig[0]: Creating... oci_core_security_list.tf_private_security_list: Creation complete after 0s [id=ocid1.securitylist.oc1.uk-london-1.aaaaaaaa...] oci_core_subnet.tf_vcn_private_subnet: Creating... oci_core_security_list.tf_public_security_list: Creation complete after 0s [id=ocid1.securitylist.oc1.uk-london-1.aaaaaaaa...] module.vcn.oci_core_route_table.ig[0]: Creation complete after 0s [id=ocid1.routetable.oc1.uk-london-1.aaaaaaaa...] oci_core_subnet.tf_vcn_public_subnet: Creating... oci_core_dhcp_options.tf_dhcp_options: Creation complete after 0s [id=ocid1.dhcpoptions.oc1.uk-london-1.aaaaaaaa...] oci_core_subnet.tf_vcn_private_subnet: Creation complete after 5s [id=ocid1.subnet.oc1.uk-london-1.aaaaaaaa...] oci_core_subnet.tf_vcn_public_subnet: Creation complete after 5s [id=ocid1.subnet.oc1.uk-london-1.aaaaaaaa...] oci_database_autonomous_database.tf_adb: Still creating... [10s elapsed] oci_database_autonomous_database.tf_adb: Still creating... [20s elapsed] oci_database_autonomous_database.tf_adb: Still creating... [30s elapsed] oci_database_autonomous_database.tf_adb: Still creating... [40s elapsed] oci_database_autonomous_database.tf_adb: Still creating... [50s elapsed] oci_database_autonomous_database.tf_adb: Creation complete after 57s [id=ocid1.autonomousdatabase.oc1.uk-london-1.abwgiljsz...] Apply complete! Resources: 10 added, 0 changed, 0 destroyed. Outputs: compartment_id = "ocid1.compartment.oc1..aaaaaaaa..." compartment_name = "obcomp3" db_name = "obadw3" db_state = "AVAILABLE" private_security_list_id = "ocid1.securitylist.oc1.uk-london-1.aaaaaaaa..." private_subnet_id = "ocid1.subnet.oc1.uk-london-1.aaaaaaaa..." public_security_list_id = "ocid1.securitylist.oc1.uk-london-1.aaaaaaaa..." public_subnet_id = "ocid1.subnet.oc1.uk-london-1.aaaaaaaa..." vcn_id = "ocid1.vcn.oc1.uk-london-1.amaaaaaa..."
Check the Oracle Cloud account to see the new infrastructure is built.
For more information see:
- Terraform : All Articles
- Terraform : Oracle Cloud Infrastructure (OCI) Provider
- Terraform : Oracle Cloud Infrastructure (OCI) Compartment
- Terraform : Oracle Cloud Infrastructure (OCI) Virtual Cloud Network (VCN)
- Terraform : Oracle Cloud Infrastructure (OCI) Autonomous Database (ADW, ATP, AJD, APX)
Hope this helps. Regards Tim...