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
, orCAPABILITY_AUTO_EXPAND
- Disable
Rollback bool Set to true to disable rollback of the stack if stack creation failed. Conflicts with
on_failure
.- Iam
Role stringArn 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.
- Notification
Arns List<string> A list of SNS topic ARNs to publish stack related events.
- On
Failure string Action to be taken if stack creation fails. This must be one of:
DO_NOTHING
,ROLLBACK
, orDELETE
. Conflicts withdisable_rollback
.- Parameters Dictionary<string, string>
A map of Parameter structures that specify input parameters for the stack.
- Policy
Body string Structure containing the stack policy body. Conflicts w/
policy_url
.- Policy
Url string Location of a file containing the stack policy. Conflicts w/
policy_body
.- Dictionary<string, string>
A list of tags to associate with this stack.
- Template
Body string Structure containing the template body (max size: 51,200 bytes).
- Template
Url string Location of a file containing the template body (max size: 460,800 bytes).
- Timeout
In intMinutes 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
, orCAPABILITY_AUTO_EXPAND
- Disable
Rollback bool Set to true to disable rollback of the stack if stack creation failed. Conflicts with
on_failure
.- Iam
Role stringArn 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.
- Notification
Arns []string A list of SNS topic ARNs to publish stack related events.
- On
Failure string Action to be taken if stack creation fails. This must be one of:
DO_NOTHING
,ROLLBACK
, orDELETE
. Conflicts withdisable_rollback
.- Parameters map[string]string
A map of Parameter structures that specify input parameters for the stack.
- Policy
Body string Structure containing the stack policy body. Conflicts w/
policy_url
.- Policy
Url string Location of a file containing the stack policy. Conflicts w/
policy_body
.- map[string]string
A list of tags to associate with this stack.
- Template
Body string Structure containing the template body (max size: 51,200 bytes).
- Template
Url string Location of a file containing the template body (max size: 460,800 bytes).
- Timeout
In intMinutes 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
, orCAPABILITY_AUTO_EXPAND
- disable
Rollback boolean Set to true to disable rollback of the stack if stack creation failed. Conflicts with
on_failure
.- iam
Role stringArn 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.
- notification
Arns string[] A list of SNS topic ARNs to publish stack related events.
- on
Failure string Action to be taken if stack creation fails. This must be one of:
DO_NOTHING
,ROLLBACK
, orDELETE
. Conflicts withdisable_rollback
.- parameters {[key: string]: string}
A map of Parameter structures that specify input parameters for the stack.
- policy
Body string Structure containing the stack policy body. Conflicts w/
policy_url
.- policy
Url string Location of a file containing the stack policy. Conflicts w/
policy_body
.- {[key: string]: string}
A list of tags to associate with this stack.
- template
Body string Structure containing the template body (max size: 51,200 bytes).
- template
Url string Location of a file containing the template body (max size: 460,800 bytes).
- timeout
In numberMinutes 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
, orCAPABILITY_AUTO_EXPAND
- disable_
rollback bool Set to true to disable rollback of the stack if stack creation failed. Conflicts with
on_failure
.- iam_
role_ strarn 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
, orDELETE
. Conflicts withdisable_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
.- 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_ intminutes 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:
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
, orCAPABILITY_AUTO_EXPAND
- Disable
Rollback bool Set to true to disable rollback of the stack if stack creation failed. Conflicts with
on_failure
.- Iam
Role stringArn 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.
- Notification
Arns List<string> A list of SNS topic ARNs to publish stack related events.
- On
Failure string Action to be taken if stack creation fails. This must be one of:
DO_NOTHING
,ROLLBACK
, orDELETE
. Conflicts withdisable_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.
- Policy
Body string Structure containing the stack policy body. Conflicts w/
policy_url
.- Policy
Url string Location of a file containing the stack policy. Conflicts w/
policy_body
.- Dictionary<string, string>
A list of tags to associate with this stack.
- Template
Body string Structure containing the template body (max size: 51,200 bytes).
- Template
Url string Location of a file containing the template body (max size: 460,800 bytes).
- Timeout
In intMinutes 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
, orCAPABILITY_AUTO_EXPAND
- Disable
Rollback bool Set to true to disable rollback of the stack if stack creation failed. Conflicts with
on_failure
.- Iam
Role stringArn 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.
- Notification
Arns []string A list of SNS topic ARNs to publish stack related events.
- On
Failure string Action to be taken if stack creation fails. This must be one of:
DO_NOTHING
,ROLLBACK
, orDELETE
. Conflicts withdisable_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.
- Policy
Body string Structure containing the stack policy body. Conflicts w/
policy_url
.- Policy
Url string Location of a file containing the stack policy. Conflicts w/
policy_body
.- map[string]string
A list of tags to associate with this stack.
- Template
Body string Structure containing the template body (max size: 51,200 bytes).
- Template
Url string Location of a file containing the template body (max size: 460,800 bytes).
- Timeout
In intMinutes 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
, orCAPABILITY_AUTO_EXPAND
- disable
Rollback boolean Set to true to disable rollback of the stack if stack creation failed. Conflicts with
on_failure
.- iam
Role stringArn 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.
- notification
Arns string[] A list of SNS topic ARNs to publish stack related events.
- on
Failure string Action to be taken if stack creation fails. This must be one of:
DO_NOTHING
,ROLLBACK
, orDELETE
. Conflicts withdisable_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.
- policy
Body string Structure containing the stack policy body. Conflicts w/
policy_url
.- policy
Url string Location of a file containing the stack policy. Conflicts w/
policy_body
.- {[key: string]: string}
A list of tags to associate with this stack.
- template
Body string Structure containing the template body (max size: 51,200 bytes).
- template
Url string Location of a file containing the template body (max size: 460,800 bytes).
- timeout
In numberMinutes 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
, orCAPABILITY_AUTO_EXPAND
- disable_
rollback bool Set to true to disable rollback of the stack if stack creation failed. Conflicts with
on_failure
.- iam_
role_ strarn 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
, orDELETE
. Conflicts withdisable_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
.- 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_ intminutes The amount of time that can pass before the stack status becomes
CREATE_FAILED
.
Import
Cloudformation Stacks can be imported using the name
, e.g.
$ pulumi import aws:cloudformation/stack:Stack stack networking-stack
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
aws
Terraform Provider.