CodexBloom - Programming Q&A Platform

OCI Resource Manager scenarios to Apply Terraform Code with 'Invalid Block Type' scenarios on Module Reference

πŸ‘€ Views: 479 πŸ’¬ Answers: 1 πŸ“… Created: 2025-06-09
terraform oci resource-manager HCL

Hey everyone, I'm running into an issue that's driving me crazy. This might be a silly question, but I'm working on a project and hit a roadblock. I'm having trouble applying my Terraform configuration through the OCI Resource Manager. When I attempt to apply the plan, I encounter the behavior: `behavior: Invalid block type`. The configuration uses a module for creating a VCN and subnets, but it seems to not recognize the module reference properly. Here’s a snippet of my Terraform code: ```hcl module "vcn" { source = "./modules/vcn" vcn_name = var.vcn_name cidr_block = var.cidr_block } resource "oci_core_virtual_network" "example_vcn" { compartment_id = var.compartment_id display_name = var.vcn_name cidr_block = var.cidr_block } ``` I have verified that the `vcn` module exists in the specified directory and corresponds correctly to the variables I'm passing. The `variables.tf` for the module includes: ```hcl variable "vcn_name" { type = string } variable "cidr_block" { type = string } ``` I have also ensured that my OCI provider version is up to date (using `terraform-provider-oci` version 4.0.0). Despite this, I keep receiving the same behavior. I've searched for similar issues, but they often relate to syntax errors or missing attributes in resources, which I don't seem to have. Could there be an scenario with how the module is structured or referenced? Any insights would be greatly appreciated. For context: I'm using Hcl on Windows. Am I missing something obvious? Any examples would be super helpful.