AWS CloudFormation Stack

This page shows how to write Terraform and CloudFormation for CloudFormation Stack and write them securely.

aws_cloudformation_stack (Terraform)

The Stack in CloudFormation can be configured in Terraform with the resource name aws_cloudformation_stack. The following sections describe 1 example of how to use the resource and its parameters.

Example Usage from GitHub
resource "aws_cloudformation_stack" "tf_sns_topic1" {
  name          = "sns-stack-services"
  template_body = data.template_file.aws_cf_sns_stack1.rendered
  tags          = local.common_tags
  on_failure    = "ROLLBACK"

Review your Terraform file for AWS best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).


Explanation in Terraform Registry

Provides a CloudFormation Stack resource.

AWS::CloudFormation::Stack (CloudFormation)

The Stack in CloudFormation can be configured in CloudFormation with the resource name AWS::CloudFormation::Stack. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

An example could not be found in GitHub.


Explanation in CloudFormation Registry

The AWS::CloudFormation::Stack type nests a stack as a resource in a top-level template.

You can add output values from a nested stack within the containing template. You use the GetAtt function with the nested stack's logical name and the name of the output value in the nested stack in the format Outputs.NestedStackOutputName.

Important We strongly recommend that updates to nested stacks are run from the parent stack.

When you apply template changes to update a top-level stack, CloudFormation updates the top-level stack and initiates an update to its nested stacks. CloudFormation updates the resources of modified nested stacks, but doesn't update the resources of unmodified nested stacks. For more information, see CloudFormation stack updates.

Note You must acknowledge IAM capabilities for nested stacks that contain IAM resources. Also, verify that you have cancel update stack permissions, which is required if an update rolls back. For more information about IAM and CloudFormation, see Controlling access with AWS Identity and Access Management.

Frequently asked questions

What is AWS CloudFormation Stack?

AWS CloudFormation Stack is a resource for CloudFormation of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS CloudFormation Stack?

For Terraform, the kmcdon83/kics-demo source code example is useful. See the Terraform Example section for further details.