Open blancoobelver opened 5 months ago
Confirmed issue with the terraform version and providers configuration after a 2nd terraform apply without changes in the code
Hi,
The same error has also been detected in at least the following modules:
Forcing the ignore to be added to the lifecycle and obtaining a warning from the provider.
ignore_changes = [
terraform_labels,
effective_labels,
]
Warning: Adding an attribute name to ignore_changes tells Terraform to ignore future changes to the argument in configuration after the object has been created, retaining the value originally configured. The attribute terraform_labels is decided by the provider alone and therefore there can be no configured value to compare with. Including this attribute in ignore_changes has no effect. Remove the attribute from ignore_changes to quiet this warning.
Best regards.
Testing various plans revealed that timestamp()
is the culprit here. timestamp()
changes value every second, causing the plan step and the apply step to produce inconsistent values. The Terraform team recommends against using this function to determine attributes in both the documentation and other discussions.
I have found during testing that replacing timestamp()
with plantimestamp()
produces a usable time such that formatdate("DD-MM-YYYY", plantimestamp())
will produce a new value each day.
@Subserial thank you very much for the reply. Finally, we have updated the provider from 5.18.0 to 5.32.0, and we no longer have the problem with terraform_labels
or effective_labels
.
Community Note
Terraform Version
Terraform v1.2.9 on windows_amd64
Affected Resource(s)
google_artifact_registry_repository
Terraform Configuration
Debug Output
https://gist.github.com/blancoobelver/0c94151dcb7f2dca887bee977895da21
Expected Behavior
Is not supposed to give an error while applying for the second time terraform apply
Actual Behavior
It´s giving an error while executing the terraform apply for the second time
Steps to reproduce
terraform init
terraform apply
terraform apply
Important Factoids
I think the error arises because I've utilized the merge function within labels. Apart from merge, I don't see any other alternatives, given that we have both calculated and predefined tags, necessitating the use of merge. However, in Google version 4.x, this issue didn't arise.
References
No response
b/336375662