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

resource/aws_cloudformation_stack: Fix perpetual diff on template with transform #9006

Merged
merged 1 commit into from
Dec 20, 2019

Conversation

hanazuki
Copy link
Contributor

In refreshing the state of an aws_cloudformation_stack, request the "Original" template body with CFn GetTemplate API to avoid perpetual diff in case the template uses macro transform, such as the AWS::Serverless framework.

ref: https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_GetTemplate.html

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" comments, they generate extra noise for pull request followers and do not help prioritize the request

Fixes #6662

Release note for CHANGELOG:

* resource/aws_cloudformation_stack: Fix perpetual diff on template with transform

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccAWSCloudFormationStack_withTransform'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -parallel 20 -run=TestAccAWSCloudFormationStack_withTransform -timeout 120m
=== RUN   TestAccAWSCloudFormationStack_withTransform
=== PAUSE TestAccAWSCloudFormationStack_withTransform
=== CONT  TestAccAWSCloudFormationStack_withTransform
--- PASS: TestAccAWSCloudFormationStack_withTransform (58.22s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       (cached)

In refreshing the state of an aws_cloudformation_stack, request the "Original" template body
with CFn GetTemplate API to avoid perpetual diff in case the template uses macro transform,
such as the AWS::Serverless framework.

ref: https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_GetTemplate.html
@ghost ghost added size/M Managed by automation to categorize the size of a PR. service/cloudformation Issues and PRs that pertain to the cloudformation service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Jun 15, 2019
@bflad bflad added bug Addresses a defect in current functionality. enhancement Requests to existing resources that expand the functionality or scope. and removed bug Addresses a defect in current functionality. labels Dec 20, 2019
@bflad bflad added this to the v2.44.0 milestone Dec 20, 2019
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for submitting this, @hanazuki, looks good. 🚀 Thank you for providing that new test case, which does present a perpetual difference without this change.

Output from acceptance testing:

--- PASS: TestAccAWSCloudFormationStack_allAttributes (66.95s)
--- PASS: TestAccAWSCloudFormationStack_basic (65.97s)
--- PASS: TestAccAWSCloudFormationStack_dataSource_basic (65.60s)
--- PASS: TestAccAWSCloudFormationStack_dataSource_yaml (68.56s)
--- PASS: TestAccAWSCloudFormationStack_defaultParams (65.19s)
--- PASS: TestAccAWSCloudFormationStack_disappears (66.83s)
--- PASS: TestAccAWSCloudFormationStack_withParams (114.62s)
--- PASS: TestAccAWSCloudFormationStack_withTransform (43.79s)
--- PASS: TestAccAWSCloudFormationStack_withUrl_withParams (116.98s)
--- PASS: TestAccAWSCloudFormationStack_withUrl_withParams_noUpdate (71.85s)
--- PASS: TestAccAWSCloudFormationStack_withUrl_withParams_withYaml (64.05s)
--- PASS: TestAccAWSCloudFormationStack_yaml (64.69s)

@bflad bflad merged commit a6f6977 into hashicorp:master Dec 20, 2019
bflad added a commit that referenced this pull request Dec 20, 2019
@ghost
Copy link

ghost commented Jan 10, 2020

This has been released in version 2.44.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@ghost
Copy link

ghost commented Mar 27, 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 Mar 27, 2020
@hanazuki hanazuki deleted the cfn-stack-transform branch March 28, 2020 07:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/cloudformation Issues and PRs that pertain to the cloudformation service. size/M Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws_cloudformation_stack should use 'Original' template instead of 'Processed' to detect change
2 participants