terraform-provider-oci
terraform-provider-oci copied to clipboard
oci_core_instance: "Note: Objects have changed outside of Terraform"
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Terraform Version and Provider Version
PS > terraform -v
Terraform v1.1.2
on windows_amd64
+ provider registry.terraform.io/hashicorp/oci v4.57.0
PS >
Affected Resource(s)
oci_core_instance
Terraform Configuration Files
resource "oci_core_instance" "test_instance" {
#Required
availability_domain = var.instance_availability_domain
#compartment_id = var.compartment_id
compartment_id = var.tenancy_ocid
shape = var.instance_shape
create_vnic_details {
subnet_id = oci_core_subnet.test_subnet.id
}
source_details {
#Required
#source_id = oci_core_image.test_image.id
source_id = var.image_OL8_x64
source_type = "image"
}
}
Expected Behavior
Resource is being created and subsequent terraform plan or apply run through smoothly.
Actual Behavior
After the initial "apply" was executed, a second "apply" (or "plan") results in:
PS > terraform apply
oci_core_vcn.test_vcn: Refreshing state... [id=ocid1.vcn.oc1.eu-frankfurt-1.amaaaaaa7rk5cdya3zooob6mexz335yfx2a5utpzrwhp5g37mr3juh2e3bna]
oci_core_subnet.test_subnet: Refreshing state... [id=ocid1.subnet.oc1.eu-frankfurt-1.aaaaaaaavd6e7wo6jjsa5gt4qm4pexrg7e2mgihpxuz3vmitpuuxuqkxrrna]
oci_core_instance.test_instance: Refreshing state... [id=ocid1.instance.oc1.eu-frankfurt-1.antheljt7rk5cdyc7zvgqsdeljhckgqbofnv4l5gvxrbim2p4mdvvw47n5kq]
Note: Objects have changed outside of Terraform
Terraform detected the following changes made outside of Terraform since the last "terraform apply":
# oci_core_instance.test_instance has changed
~ resource "oci_core_instance" "test_instance" {
+ extended_metadata = {}
id = "ocid1.instance.oc1.eu-frankfurt-1.antheljt7rk5cdyc7zvgqsdeljhckgqbofnv4l5gvxrbim2p4mdvvw47n5kq"
+ metadata = {}
# (19 unchanged attributes hidden)
~ create_vnic_details {
+ nsg_ids = []
# (8 unchanged attributes hidden)
}
# (6 unchanged blocks hidden)
}
Unless you have made equivalent changes to your configuration, or ignored the relevant attributes using ignore_changes, the following plan may include actions to undo or respond to
these changes.
Steps to Reproduce
-
terraform apply
-
terraform plan
orterraform apply
right afterwards
Important Factoids
Workaround: terraform refresh to update the state.
Uneducated guess: During the initial apply, metadata / extended_metadata and nsg_ids were not mentioned, so I guess the provider simply isn't aware of them during creation time? Drift between the provider and the API?
References
Is there any fix or workaround for this? I'm seeing the same issue. Refresh for me does not resolve the problem, bastion and operator hosts are always being destroyed and recreated, but end up in a broken state unable to load applications.
We are very sorry that we couldn't respond to each and every issue reported on GitHub. Although we have refined the process to prioritize customer issues on GitHub, since this issue was reported a while ago, there is a good chance it may have been fixed in the latest version of Terraform Provider OCI. If you are still experiencing this issue, please create a new issue and label it as Bug.