Closed svenmueller closed 3 years ago
Possible reason might be the generated unique random resource ID for local_file
resources which cause a different MD5 checksum when executing filemd5(file)
(https://github.com/terraform-google-modules/terraform-google-slo/blob/master/modules/slo/main.tf#L53).
+ resource "local_file" "error_budget_policy" {
+ content = jsonencode(
[
...
]
)
...
+ id = (known after apply)
}
I noticed that there is already an issue related to it: https://github.com/hashicorp/terraform-provider-random/issues/95
@svenmueller yeah, unfortunately this has been long-running issue with archive_file
and local_file
resources.
The fix is to not create local files, and use source.content
instead of the local filepath.
There is a PR that will fix this, but it's a breaking change on the module, requiring to pass config file paths instead of file contents. Feel free to review it as it might help fix your bug.
Fixed by #63
Terraform wants to change resources when "local files" (generated from templates in
/templates
) are recreated (e.g. when TF is run on another environment which has no local files).How to reproduce:
.terraform/
-> TF will show changes for e.g. for resources like
local_file
(create),google_cloudfunctions_function
(updated in-place),google_storage_bucket_object
(replaced).Not sure yet why, but seems like a new archive file is created (different name) event though the file content didn't change.
(Could be that the MD5 checksum is different and therefore the archive file name changes: https://github.com/terraform-google-modules/terraform-google-slo/blob/master/modules/slo/main.tf#L70)