class CloudFormationCreateReplaceChangeSetAction
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.CodePipeline.Actions.CloudFormationCreateReplaceChangeSetAction |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awscodepipelineactions#CloudFormationCreateReplaceChangeSetAction |
Java | software.amazon.awscdk.services.codepipeline.actions.CloudFormationCreateReplaceChangeSetAction |
Python | aws_cdk.aws_codepipeline_actions.CloudFormationCreateReplaceChangeSetAction |
TypeScript (source) | aws-cdk-lib » aws_codepipeline_actions » CloudFormationCreateReplaceChangeSetAction |
Implements
IAction
Extends
Action
CodePipeline action to prepare a change set.
Creates the change set if it doesn't exist based on the stack name and template that you submit. If the change set exists, AWS CloudFormation deletes it, and then creates a new one.
Example
// Source stage: read from repository
const repo = new codecommit.Repository(stack, 'TemplateRepo', {
repositoryName: 'template-repo',
});
const sourceOutput = new codepipeline.Artifact('SourceArtifact');
const source = new cpactions.CodeCommitSourceAction({
actionName: 'Source',
repository: repo,
output: sourceOutput,
trigger: cpactions.CodeCommitTrigger.POLL,
});
const sourceStage = {
stageName: 'Source',
actions: [source],
};
// Deployment stage: create and deploy changeset with manual approval
const stackName = 'OurStack';
const changeSetName = 'StagedChangeSet';
const prodStage = {
stageName: 'Deploy',
actions: [
new cpactions.CloudFormationCreateReplaceChangeSetAction({
actionName: 'PrepareChanges',
stackName,
changeSetName,
adminPermissions: true,
templatePath: sourceOutput.atPath('template.yaml'),
runOrder: 1,
}),
new cpactions.ManualApprovalAction({
actionName: 'ApproveChanges',
runOrder: 2,
}),
new cpactions.CloudFormationExecuteChangeSetAction({
actionName: 'ExecuteChanges',
stackName,
changeSetName,
runOrder: 3,
}),
],
};
new codepipeline.Pipeline(stack, 'Pipeline', {
crossAccountKeys: true,
stages: [
sourceStage,
prodStage,
],
});
Initializer
new CloudFormationCreateReplaceChangeSetAction(props: CloudFormationCreateReplaceChangeSetActionProps)
Parameters
Properties
Name | Type | Description |
---|---|---|
action | Action | The simple properties of the Action, like its Owner, name, etc. |
deployment | IRole |
actionProperties
Type:
Action
The simple properties of the Action, like its Owner, name, etc.
Note that this accessor will be called before the bind
callback.
deploymentRole
Type:
IRole
Methods
Name | Description |
---|---|
add | Add statement to the service role assumed by CloudFormation while executing this action. |
bind(scope, stage, options) | The callback invoked when this Action is added to a Pipeline. |
on | Creates an Event that will be triggered whenever the state of this Action changes. |
protected bound(scope, stage, options) | This is a renamed version of the IAction.bind method. |
ToDeploymentRolePolicy(statement)
addpublic addToDeploymentRolePolicy(statement: PolicyStatement): boolean
Parameters
- statement
Policy
Statement
Returns
boolean
Add statement to the service role assumed by CloudFormation while executing this action.
bind(scope, stage, options)
public bind(scope: Construct, stage: IStage, options: ActionBindOptions): ActionConfig
Parameters
- scope
Construct
- stage
IStage
- options
Action
Bind Options
Returns
The callback invoked when this Action is added to a Pipeline.
StateChange(name, target?, options?)
onpublic onStateChange(name: string, target?: IRuleTarget, options?: RuleProps): Rule
Parameters
- name
string
- target
IRule
Target - options
Rule
Props
Returns
Creates an Event that will be triggered whenever the state of this Action changes.
protected bound(scope, stage, options)
protected bound(scope: Construct, stage: IStage, options: ActionBindOptions): ActionConfig
Parameters
- scope
Construct
- stage
IStage
- options
Action
Bind Options
Returns
This is a renamed version of the IAction.bind
method.