Skip to content

AWS CloudFormation Stack

udx-github edited this page May 28, 2026 · 1 revision

Deploys an AWS CloudFormation stack from Rabbit configuration.

Use this module when a service needs an AWS resource that is easier to express as a CloudFormation template than as a dedicated Terraform module.

Supported Features

  • CloudFormation stack creation and updates.
  • Inline CloudFormation templates written as YAML objects or strings.
  • Stack parameters.
  • IAM capabilities.
  • Stack tags.
  • Rollback and failure handling options.
  • Stack outputs exposed back to Terraform.

Prerequisites

  • AWS credentials with permission to manage CloudFormation stacks.
  • Permissions for every AWS resource created by the template.
  • CAPABILITY_IAM or CAPABILITY_NAMED_IAM when the template creates IAM resources.

Important Notes

  • template_body is the CloudFormation template. YAML objects are encoded before being passed to CloudFormation.
  • stack_name must be unique in the target AWS account and region.
  • Set capabilities when the template creates or modifies IAM resources.
  • on_failure applies to stack creation. Use ROLLBACK, DELETE, or DO_NOTHING.
  • Parameters are passed as a string map to CloudFormation.

Minimal Example

services:
  - name: "AWS CloudFormation Stack"
    module: "aws-cloudformation"
    id: "example-stack"
    deployment_order: 135
    configurations:
      region: "us-east-1"
      stack_name: "example-stack-#{Environment}"
      capabilities:
        - "CAPABILITY_IAM"
      template_body:
        AWSTemplateFormatVersion: "2010-09-09"
        Description: "Example stack managed by Rabbit"
        Resources:
          ExampleUser:
            Type: "AWS::IAM::User"
            Properties:
              UserName: "example-user-#{Environment}"
        Outputs:
          UserName:
            Value:
              Ref: "ExampleUser"
      tags:
        owner: "#{Owner}"
        lifecycle: "#{Lifecycle}"

Outputs

Output Description
stack_id CloudFormation stack ID.
stack_outputs Map of CloudFormation stack outputs.

Full Configuration Schema

The fields below are public module inputs under configurations.

configurations:
  region: "us-east-1"
  stack_name: "example-stack"
  template_body: {}
  parameters: {}
  capabilities: []
  tags: {}
  disable_rollback: false
  timeout_in_minutes: 30
  on_failure: "ROLLBACK"
Field Type Required Description
region string Yes AWS region where the stack is deployed.
stack_name string Yes CloudFormation stack name.
template_body object or string Yes CloudFormation template body. YAML objects are encoded before deployment.
parameters map[string] No CloudFormation stack parameters. Defaults to {}.
capabilities array[string] No CloudFormation capabilities, such as CAPABILITY_IAM or CAPABILITY_NAMED_IAM. Defaults to [].
tags map[string] No Tags applied to the CloudFormation stack. Defaults to {}.
disable_rollback boolean No Disables rollback on stack operation failure. Defaults to false.
timeout_in_minutes number No Stack operation timeout in minutes. Defaults to 30.
on_failure string No Stack creation failure behavior: ROLLBACK, DELETE, or DO_NOTHING. Defaults to ROLLBACK.

Clone this wiki locally