forked from aws/aws-cdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(codepipeline): use a special bootstrapless synthesizer for cross…
…-region support Stacks Fixes aws#8082
- Loading branch information
Showing
7 changed files
with
153 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
packages/@aws-cdk/core/lib/stack-synthesizers/bootstrapless-synthesizer.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { DockerImageAssetLocation, DockerImageAssetSource, FileAssetLocation, FileAssetSource } from '../assets'; | ||
import { ISynthesisSession } from '../construct-compat'; | ||
import { addStackArtifactToAssembly, assertBound } from './_shared'; | ||
import { DefaultStackSynthesizer } from './default-synthesizer'; | ||
|
||
/** | ||
* Construction properties of {@link BootstraplessSynthesizer}. | ||
*/ | ||
export interface BootstraplessSynthesizerProps { | ||
/** The deploy Role ARN to use. */ | ||
readonly deployRoleArn: string; | ||
|
||
/** The CFN execution Role ARN to use. */ | ||
readonly cloudFormationExecutionRoleArn: string; | ||
} | ||
|
||
/** | ||
* A special synthesizer that behaves similarly to DefaultStackSynthesizer, | ||
* but doesn't require bootstrapping the environment it operates in. | ||
* Because of that, stacks using it cannot have assets inside of them. | ||
* Used by the CodePipeline construct for the support stacks needed for | ||
* cross-region replication S3 buckets. | ||
*/ | ||
export class BootstraplessSynthesizer extends DefaultStackSynthesizer { | ||
constructor(props: BootstraplessSynthesizerProps) { | ||
super({ | ||
deployRoleArn: props.deployRoleArn, | ||
cloudFormationExecutionRole: props.cloudFormationExecutionRoleArn, | ||
}); | ||
} | ||
|
||
public addFileAsset(_asset: FileAssetSource): FileAssetLocation { | ||
throw new Error('Cannot add assets to a Stack that uses the BootstraplessSynthesizer'); | ||
} | ||
|
||
public addDockerImageAsset(_asset: DockerImageAssetSource): DockerImageAssetLocation { | ||
throw new Error('Cannot add assets to a Stack that uses the BootstraplessSynthesizer'); | ||
} | ||
|
||
public synthesizeStackArtifacts(session: ISynthesisSession): void { | ||
assertBound(this.stack); | ||
|
||
// do _not_ treat the template as an asset, | ||
// because this synthesizer doesn't have a bootstrap bucket to put it in | ||
addStackArtifactToAssembly(session, this.stack, { | ||
assumeRoleArn: this.deployRoleArn, | ||
cloudFormationExecutionRoleArn: this.cloudFormationExecutionRoleArn, | ||
requiresBootstrapStackVersion: 1, | ||
}, []); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export * from './types'; | ||
export * from './default-synthesizer'; | ||
export * from './legacy'; | ||
export * from './nested'; | ||
export * from './bootstrapless-synthesizer'; | ||
export * from './nested'; |