-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Description
Describe the bug
The result of myNodegroup.nodegroupName is something like mycluster/mynodegroup. This is not the nodegroup's name.
Eg, if I try to pass this to an SDK call to describe the nodegroup, I get:
$ aws eks describe-nodegroup --cluster-name mycluster --nodegroup-name mycluster/mynodegroup
An error occurred (InvalidParameterException) when calling the DescribeNodegroup operation: The nodegroup name parameter contains invalid characters. It should begin with letter or digit and can have any of the following characters: the set of Unicode letters, digits, hyphens and underscores.
Expected Behavior
myNodegroup.nodegroupName to give the name of the nodegroup.
Current Behavior
myNodegroup.nodegroupName is the "physical resource ID", see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-eks-nodegroup.html#aws-resource-eks-nodegroup-return-values, because it uses .ref not attrNodegroupName. See eg https://github.com/aws/aws-cdk/blob/v2.33.0/packages/@aws-cdk/aws-eks/lib/managed-nodegroup.ts#L455
Reproduction Steps
Roughly, something like:
const vpc = new ec2.Vpc(this, 'Vpc');
const cluster = new eks.Cluster(this, 'Cluster', {
clusterName: 'mycluster',
});
const nodegroup = cluster.addNodegroup(...);
new CfnOutput(this, 'NodegroupName', {
value: nodegroup.nodegroupName,
});Then call aws eks describe-nodegroup --cluster-name mycluster --nodegroup-name [value from output] and see that it errors.
Possible Solution
Change .nodegroupName to be .attrNodegroupName.
Maybe add .nodegroupPhysicalResourceId as .ref?
Additional Information/Context
This would be a breaking change.
CDK CLI Version
2.33.0
Framework Version
No response
Node.js Version
16
OS
Linux
Language
Typescript
Language Version
No response
Other information
No response