# CloudFormationStackArtifact

Extends: CloudArtifact › CloudFormationStackArtifact

- Source: [`cx-api/lib/legacy-moved.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0/packages/aws-cdk-lib/cx-api/lib/legacy-moved.ts#L341)
- Type last changed: v2.167.2 · 19 Nov 2024

## Example

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { cloud_assembly_schema } from 'aws-cdk-lib';
import { cx_api } from 'aws-cdk-lib';

declare const assumeRoleAdditionalOptions: any;
declare const cloudAssembly: cx_api.CloudAssembly;
const cloudFormationStackArtifact = new cx_api.CloudFormationStackArtifact(cloudAssembly, 'artifactId', {
  type: cloud_assembly_schema.ArtifactType.NONE,

  // the properties below are optional
  additionalMetadataFile: 'additionalMetadataFile',
  dependencies: ['dependencies'],
  displayName: 'displayName',
  environment: 'environment',
  metadata: {
    metadataKey: [{
      type: 'type',

      // the properties below are optional
      data: 'data',
      trace: ['trace'],
    }],
  },
  properties: {
    templateFile: 'templateFile',

    // the properties below are optional
    assumeRoleAdditionalOptions: {
      assumeRoleAdditionalOptionsKey: assumeRoleAdditionalOptions,
    },
    assumeRoleArn: 'assumeRoleArn',
    assumeRoleExternalId: 'assumeRoleExternalId',
    bootstrapStackVersionSsmParameter: 'bootstrapStackVersionSsmParameter',
    cloudFormationExecutionRoleArn: 'cloudFormationExecutionRoleArn',
    lookupRole: {
      arn: 'arn',

      // the properties below are optional
      assumeRoleAdditionalOptions: {
        assumeRoleAdditionalOptionsKey: assumeRoleAdditionalOptions,
      },
      assumeRoleExternalId: 'assumeRoleExternalId',
      bootstrapStackVersionSsmParameter: 'bootstrapStackVersionSsmParameter',
      requiresBootstrapStackVersion: 123,
    },
    notificationArns: ['notificationArns'],
    parameters: {
      parametersKey: 'parameters',
    },
    requiresBootstrapStackVersion: 123,
    stackName: 'stackName',
    stackTemplateAssetObjectUrl: 'stackTemplateAssetObjectUrl',
    tags: {
      tagsKey: 'tags',
    },
    terminationProtection: false,
    validateOnSynth: false,
  },
});
```

## Initializer

```ts
new CloudFormationStackArtifact(assembly: CloudAssembly, artifactId: string, artifact: ArtifactManifest)
```

## Properties

- `assembly`: [CloudAssembly](/cdk/api/v2/docs/aws-cdk-lib.cx_api.CloudAssembly.html) (required)

- `assets`: [FileAssetMetadataEntry](/cdk/api/v2/docs/aws-cdk-lib.cloud_assembly_schema.FileAssetMetadataEntry.html) | [ContainerImageAssetMetadataEntry](/cdk/api/v2/docs/aws-cdk-lib.cloud_assembly_schema.ContainerImageAssetMetadataEntry.html)[] (required) — Any assets associated with this stack.

- `assumeRoleAdditionalOptions`: { [key: string]: any } — Additional options to pass to STS when assuming the role for cloudformation deployments.

  **Default:** No additional options.

  - `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.

- `assumeRoleArn`: string — The role that needs to be assumed to deploy the stack.

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

- `assumeRoleExternalId`: string — External ID to use when assuming role for cloudformation deployments.

  **Default:** No external ID

- `bootstrapStackVersionSsmParameter`: string — Name of SSM parameter with bootstrap stack version.

  **Default:** Discover SSM parameter by reading stack

- `cloudFormationExecutionRoleArn`: string — The role that is passed to CloudFormation to execute the change set.

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

- `dependencies`: [CloudArtifact](/cdk/api/v2/docs/aws-cdk-lib.cx_api.CloudArtifact.html)[] (required) — Returns all the artifacts that this artifact depends on.

- `displayName`: string (required) — 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 "<hierarchicalId> (<stackName>)"

- `environment`: [Environment](/cdk/api/v2/docs/aws-cdk-lib.cx_api.Environment.html) (required) — The environment into which to deploy this artifact.

- `hierarchicalId`: string (required) — 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`: string (required)

- `lookupRole`: [BootstrapRole](/cdk/api/v2/docs/aws-cdk-lib.cloud_assembly_schema.BootstrapRole.html) — The role to use to look up values from the target AWS account.

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

- `manifest`: [ArtifactManifest](/cdk/api/v2/docs/aws-cdk-lib.cloud_assembly_schema.ArtifactManifest.html) (required) — The artifact's manifest.

- `messages`: [SynthesisMessage](/cdk/api/v2/docs/aws-cdk-lib.cx_api.SynthesisMessage.html)[] (required) — The set of messages extracted from the artifact's metadata.

- `metadata`: { [key: string]: [MetadataEntry](/cdk/api/v2/docs/aws-cdk-lib.cloud_assembly_schema.MetadataEntry.html)[] } (required) — Returns the metadata associated with this Cloud Artifact.

- `notificationArns`: string[] — SNS Topics that will receive stack events.

- `originalName`: string (required) — The original name as defined in the CDK app.

- `parameters`: { [key: string]: string } (required) — CloudFormation parameters to pass to the stack.

- `requiresBootstrapStackVersion`: number — Version of bootstrap stack required to deploy this stack.

  **Default:** No bootstrap stack required

- `stackName`: string (required) — The physical name of this stack.

- `stackTemplateAssetObjectUrl`: string — If the stack template has already been included in the asset manifest, its asset URL.

  **Default:** Not uploaded yet, upload just before deploying

- `tags`: { [key: string]: string } (required) — CloudFormation tags to pass to the stack.

- `template`: any (required) — The CloudFormation template for this stack.

- `templateFile`: string (required) — The file name of the template.

- `templateFullPath`: string (required) — Full path to the template file.

- `terminationProtection`: boolean — Whether termination protection is enabled for this stack.

- `validateOnSynth`: boolean = false — Whether this stack should be validated by the CLI after synthesis.

## Methods

- `findMetadataByType(type: string): MetadataEntryResult[]`

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

- `fromManifest(assembly: CloudAssembly, id: string, artifact: ArtifactManifest): CloudArtifact` (static) — Returns a subclass of `CloudArtifact` based on the artifact type defined in the artifact manifest.

  **Parameters**

  - `assembly` — - The cloud assembly from which to load the artifact.
  - `id` — - The artifact ID.
  - `artifact` — - The artifact manifest.

  **Returns:** the `CloudArtifact` that matches the artifact type or `undefined` if it's an artifact type that is unrecognized by this module.

- `isCloudFormationStackArtifact(art: any): boolean` (static) — 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.
