Skip to content

StackProps

Initializer

import ros_cdk_core
ros_cdk_core.StackProps(
  description: str = None,
  enable_resource_property_constraint: bool = None,
  env: Environment = None,
  metadata: typing.Mapping[typing.Any] = None,
  stack_name: str = None,
  synthesizer: IStackSynthesizer = None,
  tags: typing.Mapping[str] = None,
  version: str = None
)

Properties

Name Type Description
description str A description of the stack.
enable_resource_property_constraint bool No description.
env Environment The ALIYUN environment (account/region) where this stack will be deployed.
metadata typing.Mapping[typing.Any] No description.
stack_name str Name to deploy the stack with.
synthesizer IStackSynthesizer Synthesis method to use while deploying this stack.
tags typing.Mapping[str] Stack tags that will be applied to all the taggable resources and the stack itself.
version str No description.

descriptionOptional

description: str
  • Type: str
  • Default: No description.

A description of the stack.


enable_resource_property_constraintOptional

enable_resource_property_constraint: bool
  • Type: bool

envOptional

env: Environment
  • Type: Environment
  • Default: The environment of the containing Stage if available, otherwise create the stack will be environment-agnostic.

The ALIYUN environment (account/region) where this stack will be deployed.

Set the region/account fields of env to either a concrete value to select the indicated environment (recommended for production stacks), or to the values of environment variables CDK_DEFAULT_REGION/CDK_DEFAULT_ACCOUNT to let the target environment depend on the ALIYUN credentials/configuration that the CDK CLI is executed under (recommended for development stacks).

If the Stack is instantiated inside a Stage, any undefined region/account fields from env will default to the same field on the encompassing Stage, if configured there.

If either region or account are not set nor inherited from Stage, the Stack will be considered "environment-agnostic"". Environment-agnostic stacks can be deployed to any environment but may not be able to take advantage of all features of the CDK.


Example

# Example automatically generated from non-compiling source. May contain errors.
# Use a concrete account and region to deploy this stack to:
# `.account` and `.region` will simply return these values.
Stack(app, "Stack1",
    env={
        "account": "123456789012",
        "region": "cn-hangzhou"
    }
)
# Use the CLI's current credentials to determine the target environment:
# `.account` and `.region` will reflect the account+region the CLI
# is configured to use (based on the user CLI credentials)
Stack(app, "Stack2",
    env={
        "account": process.env.CDK_DEFAULT_ACCOUNT,
        "region": process.env.CDK_DEFAULT_REGION
    }
)
# Define multiple stacks stage associated with an environment
my_stage = Stage(app, "MyStage",
    env={
        "account": "123456789012",
        "region": "cn-hangzhou"
    }
)
# both of these stacks will use the stage's account/region:
# `.account` and `.region` will resolve to the concrete values as above
MyStack(my_stage, "Stack1")
YourStack(my_stage, "Stack2")
# Define an environment-agnostic stack:
# `.account` and `.region` will resolve to `{ "Ref": "ALIYUN::AccountId" }` and `{ "Ref": "ALIYUN::Region" }` respectively.
# which will only resolve to actual values by ROS during deployment.
MyStack(app, "Stack1")

metadataOptional

metadata: typing.Mapping[typing.Any]
  • Type: typing.Mapping[typing.Any]

stack_nameOptional

stack_name: str
  • Type: str
  • Default: Derived from construct path.

Name to deploy the stack with.


synthesizerOptional

synthesizer: IStackSynthesizer

Synthesis method to use while deploying this stack.


tagsOptional

tags: typing.Mapping[str]
  • Type: typing.Mapping[str]
  • Default: {}

Stack tags that will be applied to all the taggable resources and the stack itself.


versionOptional

version: str
  • Type: str