Stack
Source:
src/AWS/CloudFormation/Stack.ts
An AWS CloudFormation stack — deploy an existing CloudFormation template from Alchemy as an interop/escape hatch.
Create and update are asynchronous: the provider submits the template and
then polls (bounded) until the stack reaches a terminal state, surfacing a
CREATE_FAILED / ROLLBACK_COMPLETE / UPDATE_ROLLBACK_COMPLETE status as
a typed error rather than hanging. An update whose template and parameters
are unchanged is a no-op (No updates are to be performed). Deletion waits
for DELETE_COMPLETE.
Deploying a Template
Section titled “Deploying a Template”Inline Template (SNS Topic)
const stack = yield* CloudFormation.Stack("Notifications", { templateBody: JSON.stringify({ Resources: { Topic: { Type: "AWS::SNS::Topic", Properties: { DisplayName: "alerts" } }, }, Outputs: { TopicArn: { Value: { Ref: "Topic" } } }, }),});// stack.outputs.TopicArn -> "arn:aws:sns:us-west-2:...:Notifications-Topic-..."Template with Parameters
const stack = yield* CloudFormation.Stack("Config", { templateBody: JSON.stringify({ Parameters: { Value: { Type: "String" } }, Resources: { Param: { Type: "AWS::SSM::Parameter", Properties: { Type: "String", Value: { Ref: "Value" } }, }, }, }), parameters: { Value: "hello" },});IAM Templates
Section titled “IAM Templates”const stack = yield* CloudFormation.Stack("Roles", { templateBody: iamTemplateJson, capabilities: ["CAPABILITY_NAMED_IAM"],});