CloudFormationExecuteChangeSetAction
- class aws_cdk.aws_codepipeline_actions.CloudFormationExecuteChangeSetAction(*, change_set_name, stack_name, account=None, output=None, output_file_name=None, region=None, role=None, action_name, run_order=None, variables_namespace=None)
Bases:
Action
CodePipeline action to execute a prepared change set.
- ExampleMetadata:
lit=test/integ.cfn-template-from-repo.lit.ts infused
Example:
# Source stage: read from repository repo = codecommit.Repository(stack, "TemplateRepo", repository_name="template-repo" ) source_output = codepipeline.Artifact("SourceArtifact") source = cpactions.CodeCommitSourceAction( action_name="Source", repository=repo, output=source_output, trigger=cpactions.CodeCommitTrigger.POLL ) source_stage = { "stage_name": "Source", "actions": [source] } # Deployment stage: create and deploy changeset with manual approval stack_name = "OurStack" change_set_name = "StagedChangeSet" prod_stage = { "stage_name": "Deploy", "actions": [ cpactions.CloudFormationCreateReplaceChangeSetAction( action_name="PrepareChanges", stack_name=stack_name, change_set_name=change_set_name, admin_permissions=True, template_path=source_output.at_path("template.yaml"), run_order=1 ), cpactions.ManualApprovalAction( action_name="ApproveChanges", run_order=2 ), cpactions.CloudFormationExecuteChangeSetAction( action_name="ExecuteChanges", stack_name=stack_name, change_set_name=change_set_name, run_order=3 ) ] } codepipeline.Pipeline(stack, "Pipeline", stages=[source_stage, prod_stage ] )
- Parameters:
change_set_name (
str
) – Name of the change set to execute.stack_name (
str
) – The name of the stack to apply this action to.account (
Optional
[str
]) – The AWS account this Action is supposed to operate in. Note: if you specify therole
property, this is ignored - the action will operate in the same region the passed role does. Default: - action resides in the same account as the pipelineoutput (
Optional
[Artifact
]) – The name of the output artifact to generate. Only applied ifoutputFileName
is set as well. Default: Automatically generated artifact name.output_file_name (
Optional
[str
]) – A name for the filename in the output artifact to store the AWS CloudFormation call’s result. The file will contain the result of the call to AWS CloudFormation (for example the call to UpdateStack or CreateChangeSet). AWS CodePipeline adds the file to the output artifact after performing the specified action. Default: No output artifact generatedregion (
Optional
[str
]) – The AWS region the given Action resides in. Note that a cross-region Pipeline requires replication buckets to function correctly. You can provide their names with the {@link PipelineProps#crossRegionReplicationBuckets} property. If you don’t, the CodePipeline Construct will create new Stacks in your CDK app containing those buckets, that you will need tocdk deploy
before deploying the main, Pipeline-containing Stack. Default: the Action resides in the same region as the Pipelinerole (
Optional
[IRole
]) – The Role in which context’s this Action will be executing in. The Pipeline’s Role will assume this Role (the required permissions for that will be granted automatically) right before executing this Action. This Action will be passed into your {@link IAction.bind} method in the {@link ActionBindOptions.role} property. Default: a new Role will be generatedaction_name (
str
) – The physical, human-readable name of the Action. Note that Action names must be unique within a single Stage.run_order (
Union
[int
,float
,None
]) – The runOrder property for this Action. RunOrder determines the relative order in which multiple Actions in the same Stage execute. Default: 1variables_namespace (
Optional
[str
]) – The name of the namespace to use for variables emitted by this action. Default: - a name will be generated, based on the stage and action names, if any of the action’s variables were referenced - otherwise, no namespace will be set
Methods
- bind(scope, stage, *, bucket, role)
The callback invoked when this Action is added to a Pipeline.
- Parameters:
- Return type:
- on_state_change(name, target=None, *, description=None, enabled=None, event_bus=None, event_pattern=None, rule_name=None, schedule=None, targets=None)
Creates an Event that will be triggered whenever the state of this Action changes.
- Parameters:
name (
str
) –target (
Optional
[IRuleTarget
]) –description (
Optional
[str
]) – A description of the rule’s purpose. Default: - No description.enabled (
Optional
[bool
]) – Indicates whether the rule is enabled. Default: trueevent_bus (
Optional
[IEventBus
]) – The event bus to associate with this rule. Default: - The default event bus.event_pattern (
Union
[EventPattern
,Dict
[str
,Any
],None
]) – Describes which events EventBridge routes to the specified target. These routed events are matched events. For more information, see Events and Event Patterns in the Amazon EventBridge User Guide. Default: - None.rule_name (
Optional
[str
]) – A name for the rule. Default: - AWS CloudFormation generates a unique physical ID and uses that ID for the rule name. For more information, see Name Type.schedule (
Optional
[Schedule
]) – The schedule or rate (frequency) that determines when EventBridge runs the rule. For more information, see Schedule Expression Syntax for Rules in the Amazon EventBridge User Guide. Default: - None.targets (
Optional
[Sequence
[IRuleTarget
]]) – Targets to invoke when this rule matches an event. Input will be the full matched event. If you wish to specify custom target input, useaddTarget(target[, inputOptions])
. Default: - No targets.
- Return type:
Attributes