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

Core: CfnCodeDeployBlueGreenHook TestTrafficRoute LogicalID cant be empty or undefined. #33020

Open
1 task
MattJKirby opened this issue Jan 20, 2025 · 2 comments
Labels
@aws-cdk/aws-codedeploy Related to AWS CodeDeploy bug This issue is a bug. effort/medium Medium work item – several days of effort p3 response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@MattJKirby
Copy link

Describe the bug

The documentation for the CfnCodeDeployBlueGreenHook states that the test listener for the TrafficRoutingConfig object is optional. Furthermore the blue-green-hook-syntax example states the LogicalID for the TestTrafficRoute is not required.

However, the testTrafficRoute type does not allow undefined as a value, and when I provide an empty string I get the following error in my AWS CloudFormation stack:

Invalid CloudFormation template: Logical Resource ID cannot be empty

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Version

No response

Expected Behavior

I can specify undefined or “” for the TestTrafficRoute LogicalID, when no aws::ElasticLoadBalancingV2::Listener test listener Is required.

Current Behavior

I get the following error in my AWS CloudFormation stack:

Invalid CloudFormation template: Logical Resource ID cannot be empty

Reproduction Steps

Recreate the CfnCodeDeployBlueGreenHook template example in cdk, and try to specify ”” for the testTrafficRoute LogicalID

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.164.1

Framework Version

No response

Node.js Version

v20.18.0

OS

MacOS

Language

TypeScript

Language Version

TypeScript (4.9.4)

Other information

No response

@MattJKirby MattJKirby added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jan 20, 2025
@github-actions github-actions bot added the @aws-cdk/core Related to core CDK functionality label Jan 20, 2025
@pahud pahud self-assigned this Jan 21, 2025
@pahud
Copy link
Contributor

pahud commented Jan 21, 2025

Invalid CloudFormation template: Logical Resource ID cannot be empty

if cloudformation is throwing this error, it seems CFN just doesn't allow it to be empty.

Are you able to provide a tiny self-contained code snippet in this issue so I can rapidly reproduce it?

@pahud pahud added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. p3 and removed needs-triage This issue or PR still needs to be triaged. labels Jan 21, 2025
@pahud pahud removed their assignment Jan 21, 2025
@pahud pahud added effort/medium Medium work item – several days of effort @aws-cdk/aws-codedeploy Related to AWS CodeDeploy and removed @aws-cdk/core Related to core CDK functionality labels Jan 21, 2025
@MattJKirby
Copy link
Author

MattJKirby commented Jan 22, 2025

Invalid CloudFormation template: Logical Resource ID cannot be empty

if cloudformation is throwing this error, it seems CFN just doesn't allow it to be empty.

Are you able to provide a tiny self-contained code snippet in this issue so I can rapidly reproduce it?

Hi, apologies, setup for this issue can be quite involved. Here is an example of the CfnCodeDeployBlueGreenHook:

const ecsServiceBlueGreenDeploymentHook = new CfnCodeDeployBlueGreenHook(this, 'EcsServiceBlueGreenDeploymentHook', {
            serviceRole: this.getLogicalId(ecsServiceBlueGreenDeploymentHookServiceRole.node.defaultChild as CfnRole),
            trafficRoutingConfig: {
                type: CfnTrafficRoutingType.TIME_BASED_CANARY,
                timeBasedCanary: {
                    stepPercentage: 15,
                    bakeTimeMins: 5
                }
            },
            applications: [
                {
                    target: {
                        type: 'AWS::ECS::Service',
                        logicalId: 'Service'
                    },
                    ecsAttributes: {
                        taskDefinitions: [
                            this.getLogicalId(blueTaskDefinition.node.defaultChild as CfnTaskDefinition),
                            'GreenTaskDefinition'
                        ],
                        taskSets: [
                            blueTaskSet.logicalId,
                            'GreenTaskSet'
                        ],
                        trafficRouting: {
                            prodTrafficRoute: {
                                type: 'AWS::ElasticLoadBalancingV2::Listener',
                                logicalId: this.getLogicalId(prodListener.node.defaultChild as CfnListener)
                            },
                            testTrafficRoute: {
                                type: 'AWS::ElasticLoadBalancingV2::Listener',
                                logicalId: 'TestListener'
                            },
                            targetGroups: [
                                this.getLogicalId(blueTargetGroup.node.defaultChild as CfnTargetGroup),
                                'GreenTargetGroup'
                            ]
                        }
                    }
                }
            ]
        })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-codedeploy Related to AWS CodeDeploy bug This issue is a bug. effort/medium Medium work item – several days of effort p3 response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

2 participants