fix(cloudformation): make EKS Nodegroup Ref the composite cluster/nodegroup id (#4136)

AWS::EKS::Nodegroup Ref returned the bare nodegroup name, but AWS returns the
composite "<clusterName>/<nodegroupName>" id. Publish that as the physical id
(Ref) and the readOnly Id attribute, and drive delete from the stored
ClusterName and NodegroupName attributes rather than parsing the physical id.

Removes the EKS Nodegroup Id gap row now that the attribute is set.
This commit is contained in:
Hector Ventura authored and GitHub committed 2026-09-22 00:52:41 -04:00
1 parent 9e1e974712
commit 69e371721b
3 files changed
+21 -12

No files matched your search

@@ -85,7 +85,7 @@ class EksCfnProvisionerTest {
}
@Test
void nodegroupRefIsItsNameAndItStoresTheClusterNameForDelete() throws Exception {
void nodegroupRefIsTheCompositeIdAndItStoresNamesForDelete() throws Exception {
Nodegroup created = new Nodegroup();
created.setNodegroupName("workers");
created.setClusterName("prod");
@@ -98,8 +98,11 @@ class EksCfnProvisionerTest {
"NodeRole": "arn:aws:iam::000000000000:role/nodes", "Subnets": ["subnet-1", "subnet-2"]}
"""), ctx());
assertEquals("workers", r.getPhysicalId());
// Ref and Id are the composite clusterName/nodegroupName, matching AWS.
assertEquals("prod/workers", r.getPhysicalId());
assertEquals("prod/workers", r.getAttributes().get("Id"));
assertEquals("prod", r.getAttributes().get("ClusterName"));
assertEquals("workers", r.getAttributes().get("NodegroupName"));
assertEquals("arn:aws:eks:us-east-1:000000000000:nodegroup/prod/workers/uuid",
r.getAttributes().get("Arn"));
ArgumentCaptor<Nodegroup> request = ArgumentCaptor.forClass(Nodegroup.class);
@@ -118,10 +121,11 @@ class EksCfnProvisionerTest {
}
@Test
void deleteRemovesTheNodegroupUsingTheStoredClusterName() {
void deleteRemovesTheNodegroupUsingTheStoredNames() {
StackResource r = resource("AWS::EKS::Nodegroup", "Workers");
r.setPhysicalId("workers");
r.setPhysicalId("prod/workers");
r.getAttributes().put("ClusterName", "prod");
r.getAttributes().put("NodegroupName", "workers");
provisioner.delete(r, "us-east-1");