CodexBloom - Programming Q&A Platform

OCI Resource Manager scenarios with 'Invalid Parameter' scenarios When Adding Outputs to Terraform Configuration

šŸ‘€ Views: 43 šŸ’¬ Answers: 1 šŸ“… Created: 2025-06-10
oci terraform resource-manager HCL

I'm getting frustrated with I'm converting an old project and I'm having a hard time understanding I've searched everywhere and can't find a clear answer..... I'm working through a tutorial and I'm trying to set up an OCI Resource Manager stack for deploying infrastructure using Terraform, and I'm working with an behavior when I attempt to add output variables to my configuration. The stack is failing with an 'Invalid Parameter' behavior during the apply phase. My Terraform version is 1.1.7, and I'm using the OCI provider version 3.0.0. Here's a snippet of my Terraform configuration: ```hcl provider "oci" { tenancy_ocid = var.tenancy_ocid user_ocid = var.user_ocid fingerprint = var.fingerprint private_key_path = var.private_key_path } resource "oci_core_instance" "my_instance" { availability_domain = var.availability_domain compartment_id = var.compartment_id display_name = "MyInstance" shape = "VM.Standard2.1" source_details { source_type = "image" image_id = var.image_id } } output "instance_id" { value = oci_core_instance.my_instance.id } output "instance_public_ip" { value = oci_core_instance.my_instance.public_ip } ``` I've verified that the resource `oci_core_instance.my_instance` is created successfully, and I can see its attributes in the Terraform state. However, when I run `terraform apply`, I get the following behavior: ``` behavior: Invalid Parameter on outputs.tf line 8, in output "instance_public_ip": 8: value = oci_core_instance.my_instance.public_ip ``` I've tried adjusting my output variable names and checked the documentation to ensure I’m using the correct resource attributes. I also ensured that the instance has been assigned a public IP. If I exclude the problematic output for the public IP, the apply command works fine. Any insights on why this might be happening or how I can resolve this scenario? Am I possibly missing a configuration that allows for the public IP attribute to be queried as an output? What's the best practice here? This is part of a larger service I'm building. Any ideas what could be causing this? My development environment is Linux. Thanks for taking the time to read this! The stack includes Hcl and several other technologies. Thanks for any help you can provide! My team is using Hcl for this application. My development environment is Windows 11.