Hi there,
found a pretty strange issue. It seems like a carriage return at the bottom of a template.json are "compared / diffed / parsed" in a wrong way with the actually applied state within opsworks.
It seems only to afffect version 0.7.5
0.7.5
aws_opsworks_stack
Attached as file
1) opsworks-create-stack.tf includes the data "template_file" + the module that is used for creating an opsworks stack
2) config_stack.json is the template file itself that is rendered
As there are no changes within the custom.json - terraform should not try to apply or suggest any changes that are related to the custom.json during plan or apply.
terraform plan suggests changes , terraform apply - really applies changes although there are none - Actually if you apply the changes for the custom.json they are the same in Opsworks as before.
1)
2)
plan or apply will show changes , but actually there are noneWhat i suspect to be a cause of the problem:
It seems like the carriage return "/n" within the template is deleted by the Opsworks API.
A strong indication for this issue is, that terraform plan or terraform applyshow in their change list an additional "/n" after the whole custom.json block.
If you delete the carriage return (bottom line) within the template file, the issue seems to be fixed.
Additional information:
Usage of S3 remote state files.
Cheers
Ole
I am having the same issue, with the very same setup (custom_json as a template file, S3 remote state file). Because I would like to trigger null_resources on the custom_json, this is more than just an inconvenience.
After doing some quick tests, it seems like 0.7.6 is affected as well.
A workaround is to use the trimspace interpolation function on the template.
0.7.10 is still affected.
0.9.5 is still affected…
I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Most helpful comment
A workaround is to use the trimspace interpolation function on the template.