Stack class
Provides a CloudFormation Stack resource.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const network = new aws.cloudformation.Stack("network", {
name: "networking-stack",
parameters: {
VPCCidr: "10.0.0.0/16",
},
templateBody: JSON.stringify({
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 pulumi
import json
import pulumi_aws as aws
network = aws.cloudformation.Stack("network",
name="networking-stack",
parameters={
"VPCCidr": "10.0.0.0/16",
},
template_body=json.dumps({
"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",
}],
},
},
},
}))
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var network = new Aws.CloudFormation.Stack("network", new()
{
Name = "networking-stack",
Parameters =
{
{ "VPCCidr", "10.0.0.0/16" },
},
TemplateBody = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["Parameters"] = new Dictionary<string, object?>
{
["VPCCidr"] = new Dictionary<string, object?>
{
["Type"] = "String",
["Default"] = "10.0.0.0/16",
["Description"] = "Enter the CIDR block for the VPC. Default is 10.0.0.0/16.",
},
},
["Resources"] = new Dictionary<string, object?>
{
["myVpc"] = new Dictionary<string, object?>
{
["Type"] = "AWS::EC2::VPC",
["Properties"] = new Dictionary<string, object?>
{
["CidrBlock"] = new Dictionary<string, object?>
{
["Ref"] = "VPCCidr",
},
["Tags"] = new[]
{
new Dictionary<string, object?>
{
["Key"] = "Name",
["Value"] = "Primary_CF_VPC",
},
},
},
},
},
}),
});
});
package main
import (
"encoding/json"
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/cloudformation"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
tmpJSON0, err := json.Marshal(map[string]interface{}{
"Parameters": map[string]map[string]string{
"VPCCidr": map[string]string{
"Type": "String",
"Default": "10.0.0.0/16",
"Description": "Enter the CIDR block for the VPC. Default is 10.0.0.0/16.",
},
},
"Resources": map[string]map[string]interface{}{
"myVpc": map[string]interface{}{
"Type": "AWS::EC2::VPC",
"Properties": map[string]interface{}{
"CidrBlock": map[string]string{
"Ref": "VPCCidr",
},
"Tags": []map[string]string{
{
"Key": "Name",
"Value": "Primary_CF_VPC",
},
},
},
},
},
})
if err != nil {
return err
}
json0 := string(tmpJSON0)
_, err = cloudformation.NewStack(ctx, "network", &cloudformation.StackArgs{
Name: pulumi.String("networking-stack"),
Parameters: pulumi.StringMap{
"VPCCidr": pulumi.String("10.0.0.0/16"),
},
TemplateBody: pulumi.String(json0),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_cloudformation_stack" "network" {
name = "networking-stack"
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"
}]
}
}
}
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.cloudformation.Stack;
import com.pulumi.aws.cloudformation.StackArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var network = new Stack("network", StackArgs.builder()
.name("networking-stack")
.parameters(Map.of("VPCCidr", "10.0.0.0/16"))
.templateBody(serializeJson(
jsonObject(
jsonProperty("Parameters", jsonObject(
jsonProperty("VPCCidr", jsonObject(
jsonProperty("Type", "String"),
jsonProperty("Default", "10.0.0.0/16"),
jsonProperty("Description", "Enter the CIDR block for the VPC. Default is 10.0.0.0/16.")
))
)),
jsonProperty("Resources", jsonObject(
jsonProperty("myVpc", jsonObject(
jsonProperty("Type", "AWS::EC2::VPC"),
jsonProperty("Properties", jsonObject(
jsonProperty("CidrBlock", jsonObject(
jsonProperty("Ref", "VPCCidr")
)),
jsonProperty("Tags", jsonArray(jsonObject(
jsonProperty("Key", "Name"),
jsonProperty("Value", "Primary_CF_VPC")
)))
))
))
))
)))
.build());
}
}
resources:
network:
type: aws:cloudformation:Stack
properties:
name: networking-stack
parameters:
VPCCidr: 10.0.0.0/16
templateBody:
fn::toJSON:
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
Using pulumi import, import Cloudformation Stacks using the name. For example:
$ pulumi import aws:cloudformation/stack:Stack stack networking-stack
Constructors
- Stack(String name, {StackArgs? args, CustomResourceOptions? options})
-
Creates a new Stack.
nameThe Pulumi resource name.argsArguments used to configure this Stack. The set of arguments for Stack.optionsResource options controlling this resource's behavior. - Stack.reference(String urn)
- Creates a typed reference to an existing Stack resource.
Properties
-
capabilities
↔ Output<
List< String> ?> -
A list of capabilities.
Valid values:
CAPABILITY_IAM,CAPABILITY_NAMED_IAM, orCAPABILITY_AUTO_EXPANDlatefinal -
childResources
→ Set<
Resource> -
finalinherited
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
-
disableRollback
↔ Output<
bool?> -
Set to true to disable rollback of the stack if stack creation failed.
Conflicts with
onFailure.latefinal - hashCode → int
-
The hash code for this object.
no setterinherited
-
iamRoleArn
↔ Output<
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.
latefinal
-
id
↔ Output<
String> -
getter/setter pairinherited
- isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
- isResourceReference → bool
-
Whether this instance represents a resource value returned over RPC.
finalinherited
-
name
↔ Output<
String> -
Stack name.
latefinal
-
notificationArns
↔ Output<
List< String> ?> -
A list of SNS topic ARNs to publish stack related events.
latefinal
-
onFailure
↔ Output<
String?> -
Action to be taken if stack creation fails. This must be
one of:
DO_NOTHING,ROLLBACK, orDELETE. Conflicts withdisableRollback.latefinal -
outputs
↔ Output<
Map< String, String> > -
A map of outputs from the stack.
latefinal
-
parameters
↔ Output<
Map< String, String> > -
A map of Parameter structures that specify input parameters for the stack.
latefinal
-
policyBody
↔ Output<
String> -
Structure containing the stack policy body.
Conflicts w/
policyUrl.latefinal -
policyUrl
↔ Output<
String?> -
Location of a file containing the stack policy.
Conflicts w/
policyBody.latefinal -
region
↔ Output<
String> -
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
-
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
Map of resource tags to associate with this stack. .If configured with a provider
defaultTagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.latefinal -
A map of tags assigned to the resource, including those inherited from the provider
defaultTagsconfiguration block.latefinal -
templateBody
↔ Output<
String> -
Structure containing the template body (max size: 51,200 bytes).
latefinal
-
templateUrl
↔ Output<
String?> -
Location of a file containing the template body (max size: 460,800 bytes).
latefinal
-
timeoutInMinutes
↔ Output<
int?> -
The amount of time that can pass before the stack status becomes
CREATE_FAILED.latefinal -
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
urn
↔ Output<
String> -
latefinalinherited
Methods
-
failId(
Object error) → void -
Completes this resource ID with an error when registration fails.
inherited
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
resolveId(
String? value, {required bool isKnown}) → void -
Resolves the provider-assigned ID for this resource.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited