Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(elbv2): Circular dependency when enabling logaccesslogs on bucket in extended ALB construct #27528

Closed
peterwoodworth opened this issue Oct 12, 2023 · 1 comment · Fixed by #27558
Labels
bug This issue is a bug. effort/small Small work item – less than a day of effort p2

Comments

@peterwoodworth
Copy link
Contributor

peterwoodworth commented Oct 12, 2023

Describe the bug

The comment here describes the issue perfectly

Expected Behavior

I expect there to be no circular dependency

Current Behavior

There is a circular dependency

Reproduction Steps

export class CustomLB extends ApplicationLoadBalancer {

  constructor(scope: Construct, id: string, vpc: cdk.aws_ec2.IVpc) {
    super(scope, id, { vpc });

    const accessLogsBucket = new Bucket(this, `ALBAccessLogsBucket`, {      
      blockPublicAccess: BlockPublicAccess.BLOCK_ALL,
      encryption: BucketEncryption.S3_MANAGED,
      versioned: true,
      serverAccessLogsPrefix: 'selflog/',
      enforceSSL: true,
    });

    this.logAccessLogs(accessLogsBucket);
  }
}

Possible Solution

Only add a dependency on the CfnLoadBalancer, instead of the L2 construct

// make sure the bucket's policy is created before the ALB (see https:/aws/aws-cdk/issues/1633)
this.node.addDependency(bucket);

Additional Information/Context

No response

CDK CLI Version

latest

Framework Version

No response

Node.js Version

18

OS

mac

Language

TypeScript

Language Version

No response

Other information

I'm not sure if this will have unintentional consequences with the proposed fix

@peterwoodworth peterwoodworth added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Oct 12, 2023
@github-actions github-actions bot added the @aws-cdk/aws-elasticloadbalancingv2 Related to Amazon Elastic Load Balancing V2 label Oct 12, 2023
@peterwoodworth peterwoodworth added p2 effort/small Small work item – less than a day of effort and removed needs-triage This issue or PR still needs to be triaged. @aws-cdk/aws-elasticloadbalancingv2 Related to Amazon Elastic Load Balancing V2 labels Oct 12, 2023
mikewrighton added a commit to lpizzinidev/aws-cdk that referenced this issue Nov 2, 2023
@mergify mergify bot closed this as completed in #27558 Nov 2, 2023
mergify bot pushed a commit that referenced this issue Nov 2, 2023
…on bucket in extended ALB (#27558)

Fixes circular dependency when enabling access logging on an S3 bucket in an extended ALB.

Closes #27528.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Copy link

github-actions bot commented Nov 2, 2023

⚠️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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. effort/small Small work item – less than a day of effort p2
Projects
None yet
1 participant