GetStack
The CloudFormation Stack data source allows access to stack outputs and other useful data including the template body.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var network = Output.Create(Aws.CloudFormation.GetStack.InvokeAsync(new Aws.CloudFormation.GetStackArgs
{
Name = "my-network-stack",
}));
var web = new Aws.Ec2.Instance("web", new Aws.Ec2.InstanceArgs
{
Ami = "ami-abb07bcb",
InstanceType = "t2.micro",
SubnetId = network.Apply(network => network.Outputs.SubnetId),
Tags =
{
{ "Name", "HelloWorld" },
},
});
}
}
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v3/go/aws/cloudformation"
"github.com/pulumi/pulumi-aws/sdk/v3/go/aws/ec2"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
network, err := cloudformation.LookupStack(ctx, &cloudformation.LookupStackArgs{
Name: "my-network-stack",
}, nil)
if err != nil {
return err
}
_, err = ec2.NewInstance(ctx, "web", &ec2.InstanceArgs{
Ami: pulumi.String("ami-abb07bcb"),
InstanceType: pulumi.String("t2.micro"),
SubnetId: pulumi.String(network.Outputs.SubnetId),
Tags: pulumi.StringMap{
"Name": pulumi.String("HelloWorld"),
},
})
if err != nil {
return err
}
return nil
})
}
import pulumi
import pulumi_aws as aws
network = aws.cloudformation.get_stack(name="my-network-stack")
web = aws.ec2.Instance("web",
ami="ami-abb07bcb",
instance_type="t2.micro",
subnet_id=network.outputs["SubnetId"],
tags={
"Name": "HelloWorld",
})
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const network = aws.cloudformation.getStack({
name: "my-network-stack",
});
const web = new aws.ec2.Instance("web", {
ami: "ami-abb07bcb",
instanceType: "t2.micro",
subnetId: network.then(network => network.outputs.SubnetId),
tags: {
Name: "HelloWorld",
},
});
Using GetStack
function getStack(args: GetStackArgs, opts?: InvokeOptions): Promise<GetStackResult>
def get_stack(name: Optional[str] = None, tags: Optional[Mapping[str, str]] = None, opts: Optional[InvokeOptions] = None) -> GetStackResult
func LookupStack(ctx *Context, args *LookupStackArgs, opts ...InvokeOption) (*LookupStackResult, error)
Note: This function is named
LookupStack
in the Go SDK.
public static class GetStack {
public static Task<GetStackResult> InvokeAsync(GetStackArgs args, InvokeOptions? opts = null)
}
The following arguments are supported:
- Name string
The name of the stack
- Dictionary<string, string>
A map of tags associated with this stack.
- Name string
The name of the stack
- map[string]string
A map of tags associated with this stack.
- name string
The name of the stack
- {[key: string]: string}
A map of tags associated with this stack.
- name str
The name of the stack
- Mapping[str, str]
A map of tags associated with this stack.
GetStack Result
The following output properties are available:
- Capabilities List<string>
A list of capabilities
- Description string
Description of the stack
- Disable
Rollback bool Whether the rollback of the stack is disabled when stack creation fails
- Iam
Role stringArn The ARN of the IAM role used to create the stack.
- Id string
The provider-assigned unique ID for this managed resource.
- Name string
- Notification
Arns List<string> A list of SNS topic ARNs to publish stack related events
- Outputs Dictionary<string, string>
A map of outputs from the stack.
- Parameters Dictionary<string, string>
A map of parameters that specify input parameters for the stack.
- Dictionary<string, string>
A map of tags associated with this stack.
- Template
Body string Structure containing the template body.
- Timeout
In intMinutes The amount of time that can pass before the stack status becomes
CREATE_FAILED
- Capabilities []string
A list of capabilities
- Description string
Description of the stack
- Disable
Rollback bool Whether the rollback of the stack is disabled when stack creation fails
- Iam
Role stringArn The ARN of the IAM role used to create the stack.
- Id string
The provider-assigned unique ID for this managed resource.
- Name string
- Notification
Arns []string A list of SNS topic ARNs to publish stack related events
- Outputs map[string]string
A map of outputs from the stack.
- Parameters map[string]string
A map of parameters that specify input parameters for the stack.
- map[string]string
A map of tags associated with this stack.
- Template
Body string Structure containing the template body.
- Timeout
In intMinutes The amount of time that can pass before the stack status becomes
CREATE_FAILED
- capabilities string[]
A list of capabilities
- description string
Description of the stack
- disable
Rollback boolean Whether the rollback of the stack is disabled when stack creation fails
- iam
Role stringArn The ARN of the IAM role used to create the stack.
- id string
The provider-assigned unique ID for this managed resource.
- name string
- notification
Arns string[] A list of SNS topic ARNs to publish stack related events
- outputs {[key: string]: string}
A map of outputs from the stack.
- parameters {[key: string]: string}
A map of parameters that specify input parameters for the stack.
- {[key: string]: string}
A map of tags associated with this stack.
- template
Body string Structure containing the template body.
- timeout
In numberMinutes The amount of time that can pass before the stack status becomes
CREATE_FAILED
- capabilities Sequence[str]
A list of capabilities
- description str
Description of the stack
- disable_
rollback bool Whether the rollback of the stack is disabled when stack creation fails
- iam_
role_ strarn The ARN of the IAM role used to create the stack.
- id str
The provider-assigned unique ID for this managed resource.
- name str
- notification_
arns Sequence[str] A list of SNS topic ARNs to publish stack related events
- outputs Mapping[str, str]
A map of outputs from the stack.
- parameters Mapping[str, str]
A map of parameters that specify input parameters for the stack.
- Mapping[str, str]
A map of tags associated with this stack.
- template_
body str Structure containing the template body.
- timeout_
in_ intminutes 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.