Search code examples
pulumi

Pulumi "error deleting Autoscaling Launch Configuration" with aws.eks.NodeGroup


I am getting the following error while running pulumi up, I am getting a templateBody update in the preview for aws:cloudformation:Stack spot-ng-01-nodes.

 aws:ec2:LaunchConfiguration (spot-ng-01-nodeLaunchConfiguration):
 error: deleting urn:pulumi:staging::xx-api::eks:index:NodeGroup$aws:ec2/launchConfiguration:LaunchConfiguration::spot-ng-01-nodeLaunchConfiguration: 1 error occurred:
 * error deleting Autoscaling Launch Configuration (spot-ng-01-nodeLaunchConfiguration-3a59b7e): ResourceInUse: Cannot delete launch configuration spot-ng-01-nodeLaunchConfiguration-3a59b7e because it is attached to AutoScalingGroup spot-ng-01-d1815eb6-NodeGroup-UBM7XABBGVNU
 status code: 400, request id: fc55d507-0884-4c50-aeba-33831646a914

This is the resource in question, but the code was not updated.

new eks.NodeGroup("spot-ng-01", {
              cluster: cluster,
              spotPrice: "0.1",
              instanceType: "t3.xlarge",
              taints,
              labels: { spot: "true" },
              version: "1.21",
              maxSize: 60,
              minSize: 1,
              nodeSubnetIds: options.vpc.privateSubnetIds,
              instanceProfile: new aws.iam.InstanceProfile("spot-ng-profile-01", { role: role.name }),
              nodeAssociatePublicIpAddress: false,
              nodeSecurityGroup: clusterSG,
              clusterIngressRule: cluster.eksClusterIngressRule,
              autoScalingGroupTags: {
                  Name: "spot",
                  "k8s.io/cluster-autoscaler/enabled": "true",
                  [`k8s.io/cluster-autoscaler/${clusterName}`]: "true",
              },
          });

Even after running pulumi refresh, I still get the error.


Solution

  • The solution required manual intervention, it might not be the best but it solved the issue.

    Another LaunchConfiguration was created by pulumi, I made this new LaunchConfiguration used by the AutoscalingGroup in question. then I ran pulumi up and it was able to delete the LaunchConfiguration that was stuck. Then ran pulumi refresh.