Skip to content

Data Source: awsCloudformationStack

The CloudFormation Stack data source allows access to stack outputs and other useful data including the template body.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const dataAwsCloudformationStackNetwork =
  new aws.dataAwsCloudformationStack.DataAwsCloudformationStack(
    this,
    "network",
    {
      name: "my-network-stack",
    }
  );
new aws.instance.Instance(this, "web", {
  ami: "ami-abb07bcb",
  instanceType: "t2.micro",
  subnetId: `\${${dataAwsCloudformationStackNetwork.outputs.fqn}["SubnetId"]}`,
  tags: {
    Name: "HelloWorld",
  },
});

Argument Reference

The following arguments are supported:

  • name - (Required) Name of the stack

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • capabilities - List of capabilities
  • description - Description of the stack
  • disableRollback - Whether the rollback of the stack is disabled when stack creation fails
  • notificationArns - List of SNS topic ARNs to publish stack related events
  • outputs - Map of outputs from the stack.
  • parameters - Map of parameters that specify input parameters for the stack.
  • tags - Map of tags associated with this stack.
  • templateBody - Structure containing the template body.
  • iamRoleArn - ARN of the IAM role used to create the stack.
  • timeoutInMinutes - Amount of time that can pass before the stack status becomes CREATE_FAILED