Skip to content
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

ConfigDocument JSON always triggers change with whitespace #6289

Closed
artburkart opened this issue Apr 21, 2016 · 4 comments
Closed

ConfigDocument JSON always triggers change with whitespace #6289

artburkart opened this issue Apr 21, 2016 · 4 comments

Comments

@artburkart
Copy link
Contributor

artburkart commented Apr 21, 2016

Hi there,

Terraform Version

$ terraform version
Terraform v0.6.14

Affected Resource(s)

Please list the resources as a list, for example:

  • aws_elastic_beanstalk_environment

Terraform Configuration Files

Doesn't trigger change

  setting = {
    namespace = "aws:elasticbeanstalk:healthreporting:system"
    name = "ConfigDocument"
    value = <<EOF
{"Version":1,"CloudWatchMetrics":{"Instance":{"ApplicationRequestsTotal":60},"Environment":{"ApplicationRequests5xx":60,"ApplicationRequests4xx":60,"ApplicationRequests2xx":60}}}EOF
  }

Triggers change

  setting = {
    namespace = "aws:elasticbeanstalk:healthreporting:system"
    name = "ConfigDocument"
    value = <<EOF
    {
    "CloudWatchMetrics": {
      "Environment": {
        "ApplicationRequests2xx": 60,
        "ApplicationRequests5xx": 60,
        "ApplicationRequests4xx": 60
      },
      "Instance": {
        "ApplicationRequestsTotal": 60
      }
    },
    "Version": 1
    }
    EOF
  }

Expected Behavior

terraform plan shouldn't expect a change with this config setting

Actual Behavior

Every time I run terraform plan, a change is expected, except when I copy and paste the output of the terraform plan and use it in the JSON keys in the exact same order without any whitespace.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply
  2. terraform plan

Important Factoids

Nothing special

References

Similar to 6257, but not the same.

@daveadams
Copy link
Contributor

See also #3634. I think the solution for many of these JSON issues will be for Terraform to parse the JSON from either end and compare the resulting data structure instead of just comparing the JSON strings. AWS clearly isn't always storing these documents internally as strings, but is regenerating the JSON on the fly for a describe.

@mrooney
Copy link

mrooney commented Sep 1, 2016

Seeing this also with Terraform 0.7.1. Thanks for the embedded EOF workaround, it solves the problem for now, though it would be awesome to have newlines or load from a separate JSON file without the newlines being an issue :)

@ethangunderson
Copy link

Still seeing this in v0.8.6, but the EOF workaround is not working for me.

@ghost
Copy link

ghost commented Apr 11, 2020

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.

@ghost ghost locked and limited conversation to collaborators Apr 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants