aws_cloudformation_stack should use 'Original' template instead of 'Processed' to detect change #6662
Labels
enhancement
Requests to existing resources that expand the functionality or scope.
service/cloudformation
Issues and PRs that pertain to the cloudformation service.
Milestone
Community Note
Terraform Version
Terraform v0.11.3
Affected Resource(s)
Terraform Configuration Files
We create a aws_cloudformation_stack with a template body specifying some ServerlessApplicationModel SAM resources.
This template contains a "Transform": "AWS::Serverless-2016-10-31" directive.
After stack creation, we have two templates in the AWS CloudFormation Console : the Original and the Processed.
Among differences, the processed has not anymore the Transform": "AWS::Serverless-2016-10-31" directive.
Expected Behavior
After a terraform apply, we expect no change if we run it again.
Actual Behavior
At the second terraform apply run, aws_cloudformation_stack is planned for change because template_body is considered as changes also, even if the template file has not changed.
Steps to Reproduce
terraform apply
=> the stack is createdterraform apply
=> the stack is changed but I should notImportant Factoids
I looked at the AWS CloudFormation SDK and it is mentionned the "CloudFormation.GetTemplate" AWS API supports the TemplateStage parameter to indicate the 'Original' or 'Processed' one.
When activating DEBUG logs in Terraform I see the 'Processed' (without Transform": "AWS::Serverless-2016-10-31").
I suggest to change resource_aws_cloudformation_stack.go line 295 to add TemplateStage: 'Original" in
cloudformation.GetTemplateInput.
The text was updated successfully, but these errors were encountered: