[aws-codepipeline] Cyclic reference error when importing an S3 bucket in a code pipeline defined in a different stack
See original GitHub issue❓ General Issue
Hi- I am using CDK to create a code pipeline with an S3 bucket as its source. The S3 bucket and code pipeline are defined in different stacks and per the AWS documentation we can access resources in a different stack as long as they are in the same account and AWS region: https://docs.aws.amazon.com/cdk/latest/guide/resources.html#resource_stack
The Question
This doesn’t seem to be working and I am getting a “Cyclic reference” error. Does this mean the AWS documentation is wrong? Or is there something in particular that’s missing to make this work? Sample code below
const pipelineSourceActionOutput = new Artifact();
const pipelineSourceAction = new S3SourceAction({
actionName: "S3SourceAction",
bucket: s3Bucket, // Versioned Bucket (and CloudTrail) defined in a different stack
bucketKey: `${id}/upload.zip`,
output: pipelineSourceActionOutput,
trigger: S3Trigger.EVENTS,
runOrder: 1,
});
new Pipeline(this, pipelineId, {
pipelineName: pipelineId,
stages: [
{
stageName: "Source",
actions: [pipelineSourceAction],
}
],
});
I think this line of code is causing the dependency of my stack containing S3 bucket on the stack that defined code pipeline infra: https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk/aws-codepipeline-actions/lib/s3/source-action.ts#L120-L124
Environment
- CDK CLI Version: 1.45.0
- Module Version:
- Node.js Version: 12.x.31654.0
- OS: OSX Mojave
- Language (Version): TypeScript
Other information
Issue Analytics
- State:
- Created 3 years ago
- Comments:22 (11 by maintainers)
Top GitHub Comments
@jzybert in the pipeline, you shouldn’t provide
source
andartifacts
for a CodeBuild Project, because those are controlled through the pipeline itself.Use the
PipelineProject
class instead ofProject
, and that will become much more clear 🙂.⚠️COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.