-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Description
Describe the bug
When setting the usePipelineRoleForActions: true property on the AWS CodePipeline L2 construct, deployment fails with a circular dependency error. This issue occurs despite a successful cdk synth.
ValidationError: Circular dependency between resources: [PipelineRoleDefaultPolicyC7A05455, PipelineC660917D]
Regression Issue
- Select this option if this issue appears to be a regression.
Last Known Working CDK Library Version
No response
Expected Behavior
The pipeline should deploy successfully and actions should use the pipeline's IAM role.
Current Behavior
Deployment fails with the following error:
ValidationError: Circular dependency between resources: [PipelineRoleDefaultPolicyC7A05455, PipelineC660917D]
Reproduction Steps
const pipeline = new codepipeline.Pipeline(this, 'Pipeline', {
usePipelineRoleForActions: true,
});
const sourceStage = pipeline.addStage({ stageName: 'Source' });
const buildStage = pipeline.addStage({ stageName: 'Build' });
const sourceOutput = new codepipeline.Artifact();
sourceStage.addAction(
new codepipeline_actions.CodeStarConnectionsSourceAction({
owner: `some-owner`,
repo: `some-repo-name`,
triggerOnPush: true,
connectionArn: 'arn:aws:codestar-connections:ap-southeast-2:123456789012:connection/12345678-abcd-12ab-34cdef5678gh',
actionName: `some-repo-name_Source`,
output: sourceOutput,
branch: 'master',
}));
buildStage.addAction(new codepipeline_actions.CommandsAction({
actionName: 'Commands',
input: sourceOutput,
commands: [
'export MY_OUTPUT=my-key',
],
}));
Possible Solution
No response
Additional Information/Context
No response
AWS CDK Library version (aws-cdk-lib)
2.197.0
AWS CDK CLI version
2.1016.1
Node.js Version
v20.12.2
OS
Ubuntu-22.04
Language
TypeScript
Language Version
No response
Other information
It appears that enabling usePipelineRoleForActions causes a dependency loop between the pipeline role's policy and the pipeline itself.