CodexBloom - Programming Q&A Platform

OCI Resource Manager: scenarios 'Resource not found' When Trying to Apply Terraform Plan

👀 Views: 89 đŸ’Ŧ Answers: 1 📅 Created: 2025-06-14
oci terraform resource-manager hcl

I'm running into issues when trying to apply my Terraform configuration for an OCI Resource Manager stack. After configuring my stack, I run the command to apply my plan, but I keep receiving the behavior: `behavior: Resource not found: 'oci_core_virtual_network.example'`. I've double-checked that the virtual network ID is correct and exists in the OCI console. Here's the relevant part of my configuration: ```hcl resource "oci_core_virtual_network" "example" { compartment_id = var.compartment_id display_name = "example-vcn" cidr_block = "10.0.0.0/16" } resource "oci_core_subnet" "example_subnet" { compartment_id = var.compartment_id virtual_network_id = oci_core_virtual_network.example.id display_name = "example-subnet" cidr_block = "10.0.1.0/24" availability_domain = data.oci_identity_availability_domains.example.names[0] } ``` I've verified that the compartment ID is correct and I can see it in the OCI dashboard. I also checked my Terraform state file, and it seems like the virtual network resource isn't being tracked correctly. I ran `terraform init` and `terraform plan` without any issues, but the apply command keeps failing. Could this scenario stem from the order in which the resources are being created? Or is there a question with the way the references are set up in the configuration? Any insights would be greatly appreciated!