The Automation API is now available. No CLI. No human-in-the-loop. Just your code. Learn More

Stack

Provides a CloudFormation Stack resource.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var network = new Aws.CloudFormation.Stack("network", new Aws.CloudFormation.StackArgs
        {
            Parameters = 
            {
                { "VPCCidr", "10.0.0.0/16" },
            },
            TemplateBody = @"{
  ""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""}
        ]
      }
    }
  }
}

",
        });
    }

}
package main

import (
    "fmt"

    "github.com/pulumi/pulumi-aws/sdk/v3/go/aws/cloudformation"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        _, err := cloudformation.NewStack(ctx, "network", &cloudformation.StackArgs{
            Parameters: pulumi.StringMap{
                "VPCCidr": pulumi.String("10.0.0.0/16"),
            },
            TemplateBody: pulumi.String(fmt.Sprintf("%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v", "{\n", "  \"Parameters\" : {\n", "    \"VPCCidr\" : {\n", "      \"Type\" : \"String\",\n", "      \"Default\" : \"10.0.0.0/16\",\n", "      \"Description\" : \"Enter the CIDR block for the VPC. Default is 10.0.0.0/16.\"\n", "    }\n", "  },\n", "  \"Resources\" : {\n", "    \"myVpc\": {\n", "      \"Type\" : \"AWS::EC2::VPC\",\n", "      \"Properties\" : {\n", "        \"CidrBlock\" : { \"Ref\" : \"VPCCidr\" },\n", "        \"Tags\" : [\n", "          {\"Key\": \"Name\", \"Value\": \"Primary_CF_VPC\"}\n", "        ]\n", "      }\n", "    }\n", "  }\n", "}\n", "\n")),
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_aws as aws

network = aws.cloudformation.Stack("network",
    parameters={
        "VPCCidr": "10.0.0.0/16",
    },
    template_body="""{
  "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"}
        ]
      }
    }
  }
}

""")
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const network = new aws.cloudformation.Stack("network", {
    parameters: {
        VPCCidr: "10.0.0.0/16",
    },
    templateBody: `{
  "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"}
        ]
      }
    }
  }
}
`,
});

Create a Stack Resource

new Stack(name: string, args?: StackArgs, opts?: CustomResourceOptions);
def Stack(resource_name: str, opts: Optional[ResourceOptions] = None, capabilities: Optional[Sequence[str]] = None, disable_rollback: Optional[bool] = None, iam_role_arn: Optional[str] = None, name: Optional[str] = None, notification_arns: Optional[Sequence[str]] = None, on_failure: Optional[str] = None, parameters: Optional[Mapping[str, str]] = None, policy_body: Optional[str] = None, policy_url: Optional[str] = None, tags: Optional[Mapping[str, str]] = None, template_body: Optional[str] = None, template_url: Optional[str] = None, timeout_in_minutes: Optional[int] = None)
func NewStack(ctx *Context, name string, args *StackArgs, opts ...ResourceOption) (*Stack, error)
public Stack(string name, StackArgs? args = null, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args StackArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args StackArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args StackArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

Stack Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The Stack resource accepts the following input properties:

Capabilities List<string>

A list of capabilities. Valid values: CAPABILITY_IAM, CAPABILITY_NAMED_IAM, or CAPABILITY_AUTO_EXPAND

DisableRollback bool

Set to true to disable rollback of the stack if stack creation failed. Conflicts with on_failure.

IamRoleArn string

The ARN of an IAM role that AWS CloudFormation assumes to create the stack. If you don’t specify a value, AWS CloudFormation uses the role that was previously associated with the stack. If no role is available, AWS CloudFormation uses a temporary session that is generated from your user credentials.

Name string

Stack name.

NotificationArns List<string>

A list of SNS topic ARNs to publish stack related events.

OnFailure string

Action to be taken if stack creation fails. This must be one of: DO_NOTHING, ROLLBACK, or DELETE. Conflicts with disable_rollback.

Parameters Dictionary<string, string>

A map of Parameter structures that specify input parameters for the stack.

PolicyBody string

Structure containing the stack policy body. Conflicts w/ policy_url.

PolicyUrl string

Location of a file containing the stack policy. Conflicts w/ policy_body.

Tags Dictionary<string, string>

A list of tags to associate with this stack.

TemplateBody string

Structure containing the template body (max size: 51,200 bytes).

TemplateUrl string

Location of a file containing the template body (max size: 460,800 bytes).

TimeoutInMinutes int

The amount of time that can pass before the stack status becomes CREATE_FAILED.

Capabilities []string

A list of capabilities. Valid values: CAPABILITY_IAM, CAPABILITY_NAMED_IAM, or CAPABILITY_AUTO_EXPAND

DisableRollback bool

Set to true to disable rollback of the stack if stack creation failed. Conflicts with on_failure.

IamRoleArn string

The ARN of an IAM role that AWS CloudFormation assumes to create the stack. If you don’t specify a value, AWS CloudFormation uses the role that was previously associated with the stack. If no role is available, AWS CloudFormation uses a temporary session that is generated from your user credentials.

Name string

Stack name.

NotificationArns []string

A list of SNS topic ARNs to publish stack related events.

OnFailure string

Action to be taken if stack creation fails. This must be one of: DO_NOTHING, ROLLBACK, or DELETE. Conflicts with disable_rollback.

Parameters map[string]string

A map of Parameter structures that specify input parameters for the stack.

PolicyBody string

Structure containing the stack policy body. Conflicts w/ policy_url.

PolicyUrl string

Location of a file containing the stack policy. Conflicts w/ policy_body.

Tags map[string]string

A list of tags to associate with this stack.

TemplateBody string

Structure containing the template body (max size: 51,200 bytes).

TemplateUrl string

Location of a file containing the template body (max size: 460,800 bytes).

TimeoutInMinutes int

The amount of time that can pass before the stack status becomes CREATE_FAILED.

capabilities string[]

A list of capabilities. Valid values: CAPABILITY_IAM, CAPABILITY_NAMED_IAM, or CAPABILITY_AUTO_EXPAND

disableRollback boolean

Set to true to disable rollback of the stack if stack creation failed. Conflicts with on_failure.

iamRoleArn string

The ARN of an IAM role that AWS CloudFormation assumes to create the stack. If you don’t specify a value, AWS CloudFormation uses the role that was previously associated with the stack. If no role is available, AWS CloudFormation uses a temporary session that is generated from your user credentials.

name string

Stack name.

notificationArns string[]

A list of SNS topic ARNs to publish stack related events.

onFailure string

Action to be taken if stack creation fails. This must be one of: DO_NOTHING, ROLLBACK, or DELETE. Conflicts with disable_rollback.

parameters {[key: string]: string}

A map of Parameter structures that specify input parameters for the stack.

policyBody string

Structure containing the stack policy body. Conflicts w/ policy_url.

policyUrl string

Location of a file containing the stack policy. Conflicts w/ policy_body.

tags {[key: string]: string}

A list of tags to associate with this stack.

templateBody string

Structure containing the template body (max size: 51,200 bytes).

templateUrl string

Location of a file containing the template body (max size: 460,800 bytes).

timeoutInMinutes number

The amount of time that can pass before the stack status becomes CREATE_FAILED.

capabilities Sequence[str]

A list of capabilities. Valid values: CAPABILITY_IAM, CAPABILITY_NAMED_IAM, or CAPABILITY_AUTO_EXPAND

disable_rollback bool

Set to true to disable rollback of the stack if stack creation failed. Conflicts with on_failure.

iam_role_arn str

The ARN of an IAM role that AWS CloudFormation assumes to create the stack. If you don’t specify a value, AWS CloudFormation uses the role that was previously associated with the stack. If no role is available, AWS CloudFormation uses a temporary session that is generated from your user credentials.

name str

Stack name.

notification_arns Sequence[str]

A list of SNS topic ARNs to publish stack related events.

on_failure str

Action to be taken if stack creation fails. This must be one of: DO_NOTHING, ROLLBACK, or DELETE. Conflicts with disable_rollback.

parameters Mapping[str, str]

A map of Parameter structures that specify input parameters for the stack.

policy_body str

Structure containing the stack policy body. Conflicts w/ policy_url.

policy_url str

Location of a file containing the stack policy. Conflicts w/ policy_body.

tags Mapping[str, str]

A list of tags to associate with this stack.

template_body str

Structure containing the template body (max size: 51,200 bytes).

template_url str

Location of a file containing the template body (max size: 460,800 bytes).

timeout_in_minutes int

The amount of time that can pass before the stack status becomes CREATE_FAILED.

Outputs

All input properties are implicitly available as output properties. Additionally, the Stack resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Outputs Dictionary<string, string>

A map of outputs from the stack.

Id string
The provider-assigned unique ID for this managed resource.
Outputs map[string]string

A map of outputs from the stack.

id string
The provider-assigned unique ID for this managed resource.
outputs {[key: string]: string}

A map of outputs from the stack.

id str
The provider-assigned unique ID for this managed resource.
outputs Mapping[str, str]

A map of outputs from the stack.

Look up an Existing Stack Resource

Get an existing Stack resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: StackState, opts?: CustomResourceOptions): Stack
@staticmethod
def get(resource_name: str, id: str, opts: Optional[ResourceOptions] = None, capabilities: Optional[Sequence[str]] = None, disable_rollback: Optional[bool] = None, iam_role_arn: Optional[str] = None, name: Optional[str] = None, notification_arns: Optional[Sequence[str]] = None, on_failure: Optional[str] = None, outputs: Optional[Mapping[str, str]] = None, parameters: Optional[Mapping[str, str]] = None, policy_body: Optional[str] = None, policy_url: Optional[str] = None, tags: Optional[Mapping[str, str]] = None, template_body: Optional[str] = None, template_url: Optional[str] = None, timeout_in_minutes: Optional[int] = None) -> Stack
func GetStack(ctx *Context, name string, id IDInput, state *StackState, opts ...ResourceOption) (*Stack, error)
public static Stack Get(string name, Input<string> id, StackState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

Capabilities List<string>

A list of capabilities. Valid values: CAPABILITY_IAM, CAPABILITY_NAMED_IAM, or CAPABILITY_AUTO_EXPAND

DisableRollback bool

Set to true to disable rollback of the stack if stack creation failed. Conflicts with on_failure.

IamRoleArn string

The ARN of an IAM role that AWS CloudFormation assumes to create the stack. If you don’t specify a value, AWS CloudFormation uses the role that was previously associated with the stack. If no role is available, AWS CloudFormation uses a temporary session that is generated from your user credentials.

Name string

Stack name.

NotificationArns List<string>

A list of SNS topic ARNs to publish stack related events.

OnFailure string

Action to be taken if stack creation fails. This must be one of: DO_NOTHING, ROLLBACK, or DELETE. Conflicts with disable_rollback.

Outputs Dictionary<string, string>

A map of outputs from the stack.

Parameters Dictionary<string, string>

A map of Parameter structures that specify input parameters for the stack.

PolicyBody string

Structure containing the stack policy body. Conflicts w/ policy_url.

PolicyUrl string

Location of a file containing the stack policy. Conflicts w/ policy_body.

Tags Dictionary<string, string>

A list of tags to associate with this stack.

TemplateBody string

Structure containing the template body (max size: 51,200 bytes).

TemplateUrl string

Location of a file containing the template body (max size: 460,800 bytes).

TimeoutInMinutes int

The amount of time that can pass before the stack status becomes CREATE_FAILED.

Capabilities []string

A list of capabilities. Valid values: CAPABILITY_IAM, CAPABILITY_NAMED_IAM, or CAPABILITY_AUTO_EXPAND

DisableRollback bool

Set to true to disable rollback of the stack if stack creation failed. Conflicts with on_failure.

IamRoleArn string

The ARN of an IAM role that AWS CloudFormation assumes to create the stack. If you don’t specify a value, AWS CloudFormation uses the role that was previously associated with the stack. If no role is available, AWS CloudFormation uses a temporary session that is generated from your user credentials.

Name string

Stack name.

NotificationArns []string

A list of SNS topic ARNs to publish stack related events.

OnFailure string

Action to be taken if stack creation fails. This must be one of: DO_NOTHING, ROLLBACK, or DELETE. Conflicts with disable_rollback.

Outputs map[string]string

A map of outputs from the stack.

Parameters map[string]string

A map of Parameter structures that specify input parameters for the stack.

PolicyBody string

Structure containing the stack policy body. Conflicts w/ policy_url.

PolicyUrl string

Location of a file containing the stack policy. Conflicts w/ policy_body.

Tags map[string]string

A list of tags to associate with this stack.

TemplateBody string

Structure containing the template body (max size: 51,200 bytes).

TemplateUrl string

Location of a file containing the template body (max size: 460,800 bytes).

TimeoutInMinutes int

The amount of time that can pass before the stack status becomes CREATE_FAILED.

capabilities string[]

A list of capabilities. Valid values: CAPABILITY_IAM, CAPABILITY_NAMED_IAM, or CAPABILITY_AUTO_EXPAND

disableRollback boolean

Set to true to disable rollback of the stack if stack creation failed. Conflicts with on_failure.

iamRoleArn string

The ARN of an IAM role that AWS CloudFormation assumes to create the stack. If you don’t specify a value, AWS CloudFormation uses the role that was previously associated with the stack. If no role is available, AWS CloudFormation uses a temporary session that is generated from your user credentials.

name string

Stack name.

notificationArns string[]

A list of SNS topic ARNs to publish stack related events.

onFailure string

Action to be taken if stack creation fails. This must be one of: DO_NOTHING, ROLLBACK, or DELETE. Conflicts with disable_rollback.

outputs {[key: string]: string}

A map of outputs from the stack.

parameters {[key: string]: string}

A map of Parameter structures that specify input parameters for the stack.

policyBody string

Structure containing the stack policy body. Conflicts w/ policy_url.

policyUrl string

Location of a file containing the stack policy. Conflicts w/ policy_body.

tags {[key: string]: string}

A list of tags to associate with this stack.

templateBody string

Structure containing the template body (max size: 51,200 bytes).

templateUrl string

Location of a file containing the template body (max size: 460,800 bytes).

timeoutInMinutes number

The amount of time that can pass before the stack status becomes CREATE_FAILED.

capabilities Sequence[str]

A list of capabilities. Valid values: CAPABILITY_IAM, CAPABILITY_NAMED_IAM, or CAPABILITY_AUTO_EXPAND

disable_rollback bool

Set to true to disable rollback of the stack if stack creation failed. Conflicts with on_failure.

iam_role_arn str

The ARN of an IAM role that AWS CloudFormation assumes to create the stack. If you don’t specify a value, AWS CloudFormation uses the role that was previously associated with the stack. If no role is available, AWS CloudFormation uses a temporary session that is generated from your user credentials.

name str

Stack name.

notification_arns Sequence[str]

A list of SNS topic ARNs to publish stack related events.

on_failure str

Action to be taken if stack creation fails. This must be one of: DO_NOTHING, ROLLBACK, or DELETE. Conflicts with disable_rollback.

outputs Mapping[str, str]

A map of outputs from the stack.

parameters Mapping[str, str]

A map of Parameter structures that specify input parameters for the stack.

policy_body str

Structure containing the stack policy body. Conflicts w/ policy_url.

policy_url str

Location of a file containing the stack policy. Conflicts w/ policy_body.

tags Mapping[str, str]

A list of tags to associate with this stack.

template_body str

Structure containing the template body (max size: 51,200 bytes).

template_url str

Location of a file containing the template body (max size: 460,800 bytes).

timeout_in_minutes int

The amount of time that can pass before the stack status becomes CREATE_FAILED.

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.