https://pulumi.com logo
#general
Title
# general
h

helpful-vase-31122

02/08/2024, 12:31 AM
I'm using pulumi python and have an eks cluster that needs to be replaced but anytime I run pulumi up, I get the same error:
Copy code
Type                            Name                                       Status                   Info
     pulumi:pulumi:Stack             foundation-foundation                      **failed**               1 error
 +-  └─ aws:ec2:LaunchConfiguration  foundationCluster-nodeLaunchConfiguration  **replacing failed**     1 error

Diagnostics:
  pulumi:pulumi:Stack (foundation-foundation):
    error: update failed

  aws:ec2:LaunchConfiguration (foundationCluster-nodeLaunchConfiguration):
    error: deleting urn:pulumi:foundation::foundation::eks:index:Cluster$aws:ec2/launchConfiguration:LaunchConfiguration::foundationCluster-nodeLaunchConfiguration: 1 error occurred:
    	* deleting Auto Scaling Launch Configuration (foundationCluster-nodeLaunchConfiguration-c7142a6): ResourceInUse: Cannot delete launch configuration foundationCluster-nodeLaunchConfiguration-c7142a6 because it is attached to AutoScalingGroup foundationCluster-8651d22f-NodeGroup-07pDN9eokrQk
Given that I'm just using
pulumi_eks.Cluster
, how do I go about even affecting these subcomponents?
To try and clear this up a bit, the pulumi code for this stack is only
Copy code
eks_cluster = eks.Cluster(
        resource_name="foundationCluster",
        create_oidc_provider=True,
        encryption_config_key_arn=encryption_config_key.arn,
        enabled_cluster_log_types=[
            "api",
            "audit",
            "authenticator",
            "controllerManager",
            "scheduler",
        ],
        instance_role=aws.iam.Role(
            "foundationRole",
            name=f"{aws.get_region().name}-eks",
            assume_role_policy=json.dumps(
                {
                    "Version": "2012-10-17",
                    "Statement": [
                        {
                            "Action": "sts:AssumeRole",
                            "Principal": {
                                "Service": "<http://eks.amazonaws.com|eks.amazonaws.com>",
                            },
                            "Effect": "Allow",
                            "Sid": "",
                        }
                    ],
                }
            ),
            managed_policy_arns=[
                "arn:aws:iam::aws:policy/AmazonEKSClusterPolicy",
                "arn:aws:iam::aws:policy/AmazonEKSServicePolicy",
            ],
        ).arn,
        public_subnet_ids=public_subnet,
        private_subnet_ids=private_subnet,
        vpc_id=vpc.vpc_id,
        tags={"Name": "foundation-eks-cluster", "Environment": "foundation"},
        opts=pulumi.ResourceOptions(delete_before_replace=True),
    )