-
Notifications
You must be signed in to change notification settings - Fork 677
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible bug when using defined tags and extended_metadata #606
Comments
Investigating this. |
Hello @stephenpearson This appears to be a bug in Terraform that manifests only when you have 3 factors:
When these 3 things occur, Terraform is somehow omitting our provider's diff suppression functions and causing unnecessary diffs for you. We'll need to root cause this further and give that feedback to HashiCorp. In the meantime, our latest version of the provider (v3.1.0) does not exhibit this behavior because the To upgrade from v2 to v3.1.0; follow this guide: https://www.terraform.io/docs/providers/oci/guides/version-3-upgrade.html |
Hello @alexng-canuck. Yes, I can confirm that version 3.1.0 of the provider fixes this. Nice that we can modify the metadata and extended_metadata too 👍 Thank you! I'll close this issue as it is no longer applicable to the latest version. |
Just to close on the root cause, the Terraform issue that caused this behavior is known to HashiCorp and a common behavior that folks have been seeing with other Terraform providers. The issue will always occur when you have all of the following factors:
The details are very technical, but this issue happens because both fields from (1) and (2) are being suppressed in different ways. Terraform inadvertently forgets that the attribute from (1) was originally suppressed when it attempts to suppress (2). You end up with a plan where (1) has changed even though it should have been suppressed. This is expected to be addressed in v0.12 release of Terraform. |
Terraform Version
Terraform v0.11.8
OCI Provider Version
terraform-provider-oci 2.2.4
Description:
When building a compute instance which includes defined_tags and also extended_metadata then occasionally we see strange behaviour where Terraform tries to reapply the defined_tags even though they are already set on the instance. This leads to an error.
I've narrowed this down to a specific set of circumstances. All the following conditions must be true.
extended_metadata
must be set to something, anything it seems.Test
and a defined tag calledfoo
then this would be triggered if the tag were referred to asTest.FOO
in the Terraform definition.Other actions are capable of triggering this error although I'm not sure what they are. But removing and importing the resource definitely triggers it.
Example terraform:
Assume we already have a tag namespace called
stepears
and a defined tag in that namespace calledfoo
(all lower case).Then run the following commands:
Expected behaviour: Terraform should detect that the instance is in the desired state and do nothing.
Actual behaviour:
The error is because OCI does not allow duplicate defined tags on an instance, but Terraform has somehow failed to detect that the tag is already there.
Workaround
The workaround is very simple. Just make sure that the defined tag in the HCL has exactly the same case as the one defined in OCI.
I'm not 100% sure whether this is a bug or a feature, but I'm logging this as an issue because the behaviour was certainly confusing to me especially the fact that the presence or absense of extended_metadata appears to switch the problem on and off.
Terraform Plan
plan.gz
The text was updated successfully, but these errors were encountered: