StackProps
Initializer
import { StackProps } from '@alicloud/ros-cdk-core'
const stackProps: StackProps = { ... }
Properties
Name | Type | Description |
---|---|---|
description |
string |
A description of the stack. |
enableResourcePropertyConstraint |
boolean |
No description. |
env |
Environment |
The ALIYUN environment (account/region) where this stack will be deployed. |
metadata |
{[ key: string ]: any} |
No description. |
stackName |
string |
Name to deploy the stack with. |
synthesizer |
IStackSynthesizer |
Synthesis method to use while deploying this stack. |
tags |
{[ key: string ]: string} |
Stack tags that will be applied to all the taggable resources and the stack itself. |
version |
string |
No description. |
description
Optional
public readonly description: string;
- Type: string
- Default: No description.
A description of the stack.
enableResourcePropertyConstraint
Optional
public readonly enableResourcePropertyConstraint: boolean;
- Type: boolean
env
Optional
public readonly 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
// Use a concrete account and region to deploy this stack to:
// `.account` and `.region` will simply return these values.
new 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)
new Stack(app, 'Stack2', {
env: {
account: process.env.CDK_DEFAULT_ACCOUNT,
region: process.env.CDK_DEFAULT_REGION
},
});
// Define multiple stacks stage associated with an environment
const myStage = new 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
new MyStack(myStage, 'Stack1');
new YourStack(myStage, '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.
new MyStack(app, 'Stack1');
metadata
Optional
public readonly metadata: {[ key: string ]: any};
- Type: {[ key: string ]: any}
stackName
Optional
public readonly stackName: string;
- Type: string
- Default: Derived from construct path.
Name to deploy the stack with.
synthesizer
Optional
public readonly synthesizer: IStackSynthesizer;
- Type: IStackSynthesizer
- Default:
DefaultStackSynthesizer
Synthesis method to use while deploying this stack.
tags
Optional
public readonly tags: {[ key: string ]: string};
- Type: {[ key: string ]: string}
- Default: {}
Stack tags that will be applied to all the taggable resources and the stack itself.
version
Optional
public readonly version: string;
- Type: string