Error creating IAM instance profile terraform-eks-demo: EntityAlreadyExists: Instance Profile

Submitted by Lizhe on Sat, 03/02/2019 - 22:03

 

data.aws_ami.eks-worker: Refreshing state...

 

Error: Error applying plan:

 

1 error(s) occurred:

 

* aws_iam_instance_profile.demo-node: 1 error(s) occurred:

 

* aws_iam_instance_profile.demo-node: Error creating IAM instance profile terraform-eks-demo: EntityAlreadyExists: Instance Profile terraform-eks-demo already exists.

status code: 409, request id: aa840607-3cef-11e9-a59b-6d14ad52ecd4

 

Terraform does not automatically rollback in the face of errors.

Instead, your Terraform state file has been partially updated with

any resources that successfully completed. Please address the error

 

above and apply again to incrementally change your infrastructure.

 

 

 

[root@localhost test_key]# aws iam list-instance-profiles

{

    "InstanceProfiles": [

        {

            "InstanceProfileId": "AIPAJGOV2LPM75YH7YPS2", 

            "Roles": [

                {

                    "AssumeRolePolicyDocument": {

                        "Version": "2012-10-17", 

                        "Statement": [

                            {

                                "Action": "sts:AssumeRole", 

                                "Effect": "Allow", 

                                "Principal": {

                                    "Service": "ec2.amazonaws.com"

                                }

                            }

                        ]

                    }, 

                    "RoleId": "AROAIDCZCVQ2D2UHAPCBS", 

                    "CreateDate": "2019-02-28T04:06:24Z", 

                    "RoleName": "k8srole", 

                    "Path": "/", 

                    "Arn": "arn:aws:iam::174441739162:role/k8srole"

                }

            ], 

            "CreateDate": "2019-02-28T04:06:24Z", 

            "InstanceProfileName": "k8srole", 

            "Path": "/", 

            "Arn": "arn:aws:iam::174441739162:instance-profile/k8srole"

        }, 

        {

            "InstanceProfileId": "AIPAJHRCQU5R7NIK5GNAM", 

            "Roles": [], 

            "CreateDate": "2019-02-12T04:21:26Z", 

            "InstanceProfileName": "terraform-eks-demo", 

            "Path": "/", 

            "Arn": "arn:aws:iam::174441739162:instance-profile/terraform-eks-demo"

        }

    ]

}

[root@localhost test_key]# aws iam delete-instance-profile --instance-profile-name terraform-eks-demo

[root@localhost test_key]#