awscc_cloudformation_stack (Resource)

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

Example Usage

Creates a CloudFormation stack with VPC as a resource in it.

resource "awscc_cloudformation_stack" "example" {
  stack_name                    = "example-stack"
  description                   = "Example stack"
  enable_termination_protection = false

  parameters = {
    VPCCidr = "10.0.0.0/16"
  }

  template_body = jsonencode({
    Parameters = {
      VPCCidr = {
        Type        = "String"
        Default     = "10.0.0.0/16"
        Description = "Enter the CIDR block for the VPC. Default is 10.0.0.0/16."
      }
    }

    Resources = {
      myVpc = {
        Type = "AWS::EC2::VPC"
        Properties = {
          CidrBlock = {
            "Ref" = "VPCCidr"
          }
          Tags = [
            {
              Key   = "Name"
              Value = "Primary_CF_VPC"
            }
          ]
        }
      }
    }
  })

  tags = [{
    key   = "Modified By"
    value = "AWSCC"
  }]
}

Schema

Required

Optional

Read-Only

Nested Schema for tags

Required:

Nested Schema for outputs

Read-Only:

Import

Import is supported using the following syntax:

$ terraform import awscc_cloudformation_stack.example <resource ID>