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 #150

Closed
hashibot opened this issue Jun 13, 2017 · 1 comment · Fixed by #901
Closed

ConfigDocument JSON always triggers change with whitespace #150

hashibot opened this issue Jun 13, 2017 · 1 comment · Fixed by #901
Labels
bug Addresses a defect in current functionality.

Comments

@hashibot
Copy link

This issue was originally opened by @artburkart as hashicorp/terraform#6289. It was migrated here as part of the provider split. The original body of the issue is below.


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.

@hashibot hashibot added the bug Addresses a defect in current functionality. label Jun 13, 2017
artburkart pushed a commit to artburkart/terraform-provider-aws that referenced this issue Jun 17, 2017
All this commit does is add a call to `normalizeJsonString`, so the
settings returned by the AWS API and the settings set by users in the tf
config don't indicate diffs in the tf state whenever there's extra
whitespace in the JSON. I added a case to the `structure_test.go` file, to
verify that `normalizeJsonString` treats regular strings the way I'd
expect.

I would have added an acceptance test, but the 15-20 minute feedback loop
is far too long to be practical. I tried figuring out a way to spoof the
flow instead, but had no luck.
radeksimko added a commit that referenced this issue Jul 20, 2017
Closes #150: EB diffs settings correctly
@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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@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.
Labels
bug Addresses a defect in current functionality.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant