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

aws_elasticloadbalancingv2: Tagging an ALB listener rule not working #28309

Open
hguillermo opened this issue Dec 8, 2023 · 6 comments
Open
Labels
@aws-cdk/aws-elasticloadbalancingv2 Related to Amazon Elastic Load Balancing V2 blocked Work is blocked on this issue for this codebase. Other labels or comments may indicate why. bug This issue is a bug. effort/medium Medium work item – several days of effort needs-cfn This issue is waiting on changes to CloudFormation before it can be addressed. p3

Comments

@hguillermo
Copy link
Contributor

Describe the bug

Tagging an ALB listener rule not working as expected. I am not getting any error. It is not creating the Tags.

I have this ALB listener rule:

        const applicationListenerRule = new alb.ApplicationListenerRule(
            this,
            `ListenerRule${server.node.id}`,
            {
                listener: listener,
                priority: priority,
                conditions: [
                    alb.ListenerCondition.hostHeaders([recordSet.domainName]),
                ],
                action: alb.ListenerAction.authenticateOidc({
                    authorizationEndpoint: oktaJson.authorizationEndpoint || '',
                    issuer: oktaJson.issuer || '',
                    tokenEndpoint: oktaJson.tokenEndpoint || '',
                    userInfoEndpoint: oktaJson.userInfoEndpoint || '',
                    next:
                        alb.ListenerAction.forward([instanceTargetGroup]) || '',
                    clientId: oktaJson.clientId || '',
                    clientSecret: SecretValue.secretsManager(
                        oktaJson.clientSecret || ''
                    ),
                }),
            }
        );

        Tags.of(applicationListenerRule).add(
            'Name',
            'my-name'
        );

The last part of the code is not creating the tag Name.

Expected Behavior

I am expecting the Tag to be created for the ALB listener rule.

Current Behavior

CDK deployment ran correctly but after inspecting the Cloud Formation I don't see the Tag section for the ALB listener rule

Reproduction Steps

  1. Create an ALB
  2. Create an ALB Listener rule
  3. Tag the ALB Listener rule
  4. Do a CDK Synth
  5. Check the CF. The Tag will not be created

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.102.0

Framework Version

No response

Node.js Version

v18.18.2

OS

Mac OS

Language

TypeScript

Language Version

Version 5.2.2

Other information

No response

@hguillermo hguillermo added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Dec 8, 2023
@github-actions github-actions bot added the @aws-cdk/aws-elasticloadbalancingv2 Related to Amazon Elastic Load Balancing V2 label Dec 8, 2023
@khushail
Copy link
Contributor

khushail commented Dec 8, 2023

Hi @hguillermo , looks like the solution suggested here might work for you. Let me know if this works for you

@khushail khushail added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed needs-triage This issue or PR still needs to be triaged. labels Dec 8, 2023
Copy link

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Dec 11, 2023
@hguillermo
Copy link
Contributor Author

Hi @khushail

I tried this code:

new cdk.Tag("testkey", "test").visit(applicationListenerRule.node.defaultChild as cdk.CfnResource)

and

new cdk.Tag("testkey", "test").visit(applicationListenerRule)

It didn't work. I think it is a bug. I didn't check the code yet but I might have to try to put a PR to fix this.

Ideas?

@github-actions github-actions bot removed closing-soon This issue will automatically close in 4 days unless further comments are made. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. labels Dec 11, 2023
@pahud
Copy link
Contributor

pahud commented Dec 12, 2023

Hi

AWS::ElasticLoadBalancingV2::ListenerRule - this resource does not have Tag property from CFN's spec and that explains why it can't be tagged.

@pahud pahud added p2 effort/medium Medium work item – several days of effort response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. labels Dec 12, 2023
@hguillermo
Copy link
Contributor Author

Hi @pahud,
Interesting. I just saw it and I am disappointed. The UI allows you tagging listener rules. I don't understand why CFN does not support it. A few things:

  1. Tagging listener rules are supported in the console
  2. It is not clear to me why CFN doesn't support it based in the link your shared
  3. CDK doesn't complain or shows a warning. It just fails silently which is not great
  4. Guessing if a custom construct with a SDK call could be a good temporary solution?

Ideas?

@pahud
Copy link
Contributor

pahud commented Dec 12, 2023

@hguillermo

This has been in the roadmap of the CFN coverage, see aws-cloudformation/cloudformation-coverage-roadmap#1526

Before CFN supports that, CDK can hardly do anything unless custom resource, which is not a clean solution.

The Tags or Tag class essentially iterate all the resources within a construct and apply the tags if they are "taggable", which means the CFN resource has the Tag property. However, if a resource is not "taggable", the Tag class will not throw any warnings. But I agree with you it should allow users to optionally see some warnings or debugging messages.

@pahud pahud added needs-cfn This issue is waiting on changes to CloudFormation before it can be addressed. blocked Work is blocked on this issue for this codebase. Other labels or comments may indicate why. labels Dec 12, 2023
@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Dec 12, 2023
@pahud pahud added p3 and removed p2 labels Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-elasticloadbalancingv2 Related to Amazon Elastic Load Balancing V2 blocked Work is blocked on this issue for this codebase. Other labels or comments may indicate why. bug This issue is a bug. effort/medium Medium work item – several days of effort needs-cfn This issue is waiting on changes to CloudFormation before it can be addressed. p3
Projects
None yet
Development

No branches or pull requests

3 participants