普卢米 "error deleting Autoscaling Launch Configuration" 和 aws.eks.NodeGroup

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

我在 运行 pulumi up 时收到以下错误,我在 aws:cloudformation:Stack spot-ng-01-nodes 的预览中收到 templateBody 更新。

 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

这是有问题的资源,但代码未更新。

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",
              },
          });

即使在 运行 pulumi refresh 之后,我仍然得到错误。

该解决方案需要人工干预,它可能不是最好的,但它解决了问题。

另一个 LaunchConfiguration 是由 pulumi 创建的,我创建了这个新的 LaunchConfiguration 供相关的 AutoscalingGroup 使用。然后我 运行 pulumi up 并且它能够删除卡住的 LaunchConfiguration。然后 运行 pulumi refresh.