-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Normalize REST API Policy JSON before unquoting #4606
Conversation
This is required to unescape non-quote characters, e.g. forward slashes in CIDR blocks, which the AWS API escapes in its JSON responses. Resolves: hashicorp#4397
Having trouble running acceptance tests locally for some reason, are they covered by the CI? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this fix @ouroboros8!! I was able to confirm it by adjusting the existing policy acceptance test to include this condition:
"Condition": {
"IpAddress": {
"aws:SourceIp": "123.123.123.123/32"
}
}
Which previously returned:
make testacc TEST=./aws TESTARGS='-run=TestAccAWSAPIGatewayRestApi_policy'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSAPIGatewayRestApi_policy -timeout 120m
=== RUN TestAccAWSAPIGatewayRestApi_policy
--- FAIL: TestAccAWSAPIGatewayRestApi_policy (7.22s)
testing.go:518: Step 0 error: Error applying: 1 error(s) occurred:
* aws_api_gateway_rest_api.test: 1 error(s) occurred:
* aws_api_gateway_rest_api.test: error unescaping policy: invalid syntax
testing.go:579: Error destroying resource! WARNING: Dangling resources
may exist. The full state and error is shown below.
Error: Error refreshing: 1 error(s) occurred:
* aws_api_gateway_rest_api.test: 1 error(s) occurred:
* aws_api_gateway_rest_api.test: aws_api_gateway_rest_api.test: error unescaping policy: invalid syntax
State: <nil>
FAIL
FAIL github.com/terraform-providers/terraform-provider-aws/aws 7.255s
make: *** [testacc] Error 1
And with the updated code:
make testacc TEST=./aws TESTARGS='-run=TestAccAWSAPIGatewayRestApi_policy'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSAPIGatewayRestApi_policy -timeout 120m
=== RUN TestAccAWSAPIGatewayRestApi_policy
--- PASS: TestAccAWSAPIGatewayRestApi_policy (25.52s)
PASS
ok github.com/terraform-providers/terraform-provider-aws/aws 25.555s
Awesome, thank you!!! |
This has been released in version 1.20.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
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! |
Fixes #4397
This is required to unescape non-quote characters, e.g. forward slashes
in CIDR blocks, which the AWS API escapes in its JSON responses.
Acceptance test results to follow.