CodexBloom - Programming Q&A Platform

OCI Resource Manager scenarios to Create Stack with 'InvalidConfiguration' scenarios in Terraform

👀 Views: 17 đŸ’Ŧ Answers: 1 📅 Created: 2025-08-20
terraform oci infrastructure-as-code HCL

I can't seem to get I've searched everywhere and can't find a clear answer. I'm maintaining legacy code that I'm trying to deploy an infrastructure stack in OCI using Terraform, but I keep working with an 'InvalidConfiguration' behavior when I run the apply command. My configuration code is as follows: ```hcl provider "oci" { tenancy_ocid = var.tenancy_ocid user_ocid = var.user_ocid fingerprint = var.fingerprint private_key_path = var.private_key_path region = var.region } resource "oci_core_virtual_network" "my_vcn" { compartment_id = var.compartment_id cidr_block = "10.0.0.0/16" display_name = "My_VCN" } resource "oci_core_subnet" "my_subnet" { compartment_id = var.compartment_id vcn_id = oci_core_virtual_network.my_vcn.id cidr_block = "10.0.1.0/24" display_name = "My_Subnet" dns_label = "mysubnet" availability_domain = "${data.oci_identity_availability_domains.ads.names[0]}" } ``` I've checked the `compartment_id` and the `region`, and they both seem correct. I also verified that the availability domain is indeed valid for my tenancy. However, the behavior message doesn't provide much context about what might be wrong. I tried running `terraform plan` first, and it seems fine until I execute `terraform apply`. Additionally, I upgraded my OCI Terraform provider to version `3.0.0`, thinking there might be some bug in the previous version. Has anyone experienced a similar scenario or can provide insights on what could possibly cause this behavior? I would appreciate any help on debugging or suggestions for best practices regarding OCI configurations in Terraform. This is happening in both development and production on Ubuntu 20.04. Hoping someone can shed some light on this. My development environment is CentOS. I'd love to hear your thoughts on this.