CloudFormationStackArtifact

class aws_cdk.cx_api.CloudFormationStackArtifact(assembly, artifact_id, *, type, dependencies=None, display_name=None, environment=None, metadata=None, properties=None)

Bases: CloudArtifact

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.cloud_assembly_schema as cloud_assembly_schema
import aws_cdk.cx_api as cx_api

# assume_role_additional_options: Any
# cloud_assembly: cx_api.CloudAssembly

cloud_formation_stack_artifact = cx_api.CloudFormationStackArtifact(cloud_assembly, "artifactId",
    type=cloud_assembly_schema.ArtifactType.NONE,

    # the properties below are optional
    dependencies=["dependencies"],
    display_name="displayName",
    environment="environment",
    metadata={
        "metadata_key": [cloud_assembly_schema.MetadataEntry(
            type="type",

            # the properties below are optional
            data="data",
            trace=["trace"]
        )]
    },
    properties=cloud_assembly_schema.AwsCloudFormationStackProperties(
        template_file="templateFile",

        # the properties below are optional
        assume_role_additional_options={
            "assume_role_additional_options_key": assume_role_additional_options
        },
        assume_role_arn="assumeRoleArn",
        assume_role_external_id="assumeRoleExternalId",
        bootstrap_stack_version_ssm_parameter="bootstrapStackVersionSsmParameter",
        cloud_formation_execution_role_arn="cloudFormationExecutionRoleArn",
        lookup_role=cloud_assembly_schema.BootstrapRole(
            arn="arn",

            # the properties below are optional
            assume_role_additional_options={
                "assume_role_additional_options_key": assume_role_additional_options
            },
            assume_role_external_id="assumeRoleExternalId",
            bootstrap_stack_version_ssm_parameter="bootstrapStackVersionSsmParameter",
            requires_bootstrap_stack_version=123
        ),
        notification_arns=["notificationArns"],
        parameters={
            "parameters_key": "parameters"
        },
        requires_bootstrap_stack_version=123,
        stack_name="stackName",
        stack_template_asset_object_url="stackTemplateAssetObjectUrl",
        tags={
            "tags_key": "tags"
        },
        termination_protection=False,
        validate_on_synth=False
    )
)
Parameters:
  • assembly (CloudAssembly) –

  • artifact_id (str) –

  • type (ArtifactType) – The type of artifact.

  • dependencies (Optional[Sequence[str]]) – IDs of artifacts that must be deployed before this artifact. Default: - no dependencies.

  • display_name (Optional[str]) – A string that represents this artifact. Should only be used in user interfaces. Default: - no display name

  • environment (Optional[str]) – The environment into which this artifact is deployed. Default: - no envrionment.

  • metadata (Optional[Mapping[str, Sequence[Union[MetadataEntry, Dict[str, Any]]]]]) – Associated metadata. Default: - no metadata.

  • properties (Union[AwsCloudFormationStackProperties, Dict[str, Any], AssetManifestProperties, TreeArtifactProperties, NestedCloudAssemblyProperties, None]) – The set of properties for this artifact (depends on type). Default: - no properties.

Methods

find_metadata_by_type(type)
Parameters:

type (str) –

Return type:

List[MetadataEntryResult]

Returns:

all the metadata entries of a specific type in this artifact.

Attributes

assembly
assets

Any assets associated with this stack.

assume_role_additional_options

Additional options to pass to STS when assuming the role for cloudformation deployments.

  • RoleArn should not be used. Use the dedicated assumeRoleArn property instead.

  • ExternalId should not be used. Use the dedicated assumeRoleExternalId instead.

  • TransitiveTagKeys defaults to use all keys (if any) specified in Tags. E.g, all tags are transitive by default.

Default:
  • No additional options.

See:

https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/STS.html#assumeRole-property

assume_role_arn

The role that needs to be assumed to deploy the stack.

Default:
  • No role is assumed (current credentials are used)

assume_role_external_id

External ID to use when assuming role for cloudformation deployments.

Default:
  • No external ID

bootstrap_stack_version_ssm_parameter

Name of SSM parameter with bootstrap stack version.

Default:
  • Discover SSM parameter by reading stack

cloud_formation_execution_role_arn

The role that is passed to CloudFormation to execute the change set.

Default:
  • No role is passed (currently assumed role/credentials are used)

dependencies

Returns all the artifacts that this artifact depends on.

display_name

A string that represents this stack.

Should only be used in user interfaces. If the stackName has not been set explicitly, or has been set to artifactId, it will return the hierarchicalId of the stack. Otherwise, it will return something like “ ()”

environment

The environment into which to deploy this artifact.

hierarchical_id

An identifier that shows where this artifact is located in the tree of nested assemblies, based on their manifests.

Defaults to the normal id. Should only be used in user interfaces.

id
lookup_role

The role to use to look up values from the target AWS account.

Default:
  • No role is assumed (current credentials are used)

manifest

The artifact’s manifest.

messages

The set of messages extracted from the artifact’s metadata.

name

(deprecated) The physical name of this stack.

Deprecated:

renamed to stackName

Stability:

deprecated

notification_arns

SNS Topics that will receive stack events.

original_name

The original name as defined in the CDK app.

parameters

CloudFormation parameters to pass to the stack.

requires_bootstrap_stack_version

Version of bootstrap stack required to deploy this stack.

Default:
  • No bootstrap stack required

stack_name

The physical name of this stack.

stack_template_asset_object_url

If the stack template has already been included in the asset manifest, its asset URL.

Default:
  • Not uploaded yet, upload just before deploying

tags

CloudFormation tags to pass to the stack.

template

The CloudFormation template for this stack.

template_file

The file name of the template.

template_full_path

Full path to the template file.

termination_protection

Whether termination protection is enabled for this stack.

validate_on_synth

Whether this stack should be validated by the CLI after synthesis.

Default:
  • false

Static Methods

classmethod from_manifest(assembly, id, *, type, dependencies=None, display_name=None, environment=None, metadata=None, properties=None)

Returns a subclass of CloudArtifact based on the artifact type defined in the artifact manifest.

Parameters:
  • assembly (CloudAssembly) – The cloud assembly from which to load the artifact.

  • id (str) – The artifact ID.

  • type (ArtifactType) – The type of artifact.

  • dependencies (Optional[Sequence[str]]) – IDs of artifacts that must be deployed before this artifact. Default: - no dependencies.

  • display_name (Optional[str]) – A string that represents this artifact. Should only be used in user interfaces. Default: - no display name

  • environment (Optional[str]) – The environment into which this artifact is deployed. Default: - no envrionment.

  • metadata (Optional[Mapping[str, Sequence[Union[MetadataEntry, Dict[str, Any]]]]]) – Associated metadata. Default: - no metadata.

  • properties (Union[AwsCloudFormationStackProperties, Dict[str, Any], AssetManifestProperties, TreeArtifactProperties, NestedCloudAssemblyProperties, None]) – The set of properties for this artifact (depends on type). Default: - no properties.

Return type:

Optional[CloudArtifact]

Returns:

the CloudArtifact that matches the artifact type or undefined if it’s an artifact type that is unrecognized by this module.

classmethod is_cloud_formation_stack_artifact(art)

Checks if art is an instance of this class.

Use this method instead of instanceof to properly detect CloudFormationStackArtifact instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the cx-api library on disk are seen as independent, completely different libraries. As a consequence, the class CloudFormationStackArtifact in each copy of the cx-api library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the cx-api library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters:

art (Any) –

Return type:

bool