Terraform, AWS - aws Instance Profile already exists error

Problem

"aws Instance Profile already exists error"

$ terraform --version
Terraform v0.9.8

Solution

This is a know issue with terraform, see:
https://github.com/hashicorp/terraform/issues/3749
, read:
brikis98 commented on 4 Nov 2015

Update: it turns out that instance profiles don't show up in the AWS console. Well, they do, but only attached to a role. If you delete the role, but not the policy, then there is no longer a way to see the policy in the console.

Therefore, instead of using the console, you can use the AWS CLI to see all the instance profiles:

aws iam list-instance-profiles

With that command, I found the old, conflicting profiles, so the terraform error message was correct.
Instructions for Ubuntu:
  • Install aws-cli
    • $ sudo apt install python-pip
    • $ pip install awscli
  • Update pip
    • $ pip install --upgrade pip
  • Configure aws-cli
    • $ aws configure
  • Delete the instance profile
    • $ aws iam delete-instance-profile --instance-profile-name <instance_profile_name>


Comments

Popular posts from this blog

Hibernate - HibernateException: createQuery is not valid without active transaction