При попытке выполнить "terraform apply" в ходе выполнения на создании "IAM Profile" он завершается со следующей ошибкой:
* aws_iam_instance_profile.ecs_profile: 1 error occurred: * aws_iam_instance_profile.ecs_profile: Error creating IAM instance profile stg-artem-service-profile: EntityAlreadyExists: Instance Profile stg-artem-service-profile already exists. status code: 409, request id: a77fec43-7ad2-11e9-9e4e-7744dbc7b890
Решение:
При помощи AWS Cli найти IAM Profile и удалить его.
aws --profile artem iam list-instance-profiles
Смотрим список существующих IAM Profile:
{
"InstanceProfiles": [
{
"Path": "/",
"InstanceProfileName": "stg-artem-service-profile",
"InstanceProfileId": "YYYYYYYYYYYYYYYYYYYYY",
"Arn": "arn:aws:iam::XXXXXXXXXXXX:instance-profile/stg-artem-service-profile",
"CreateDate": "2019-05-17T14:06:27Z",
"Roles": []
}
]
}
Удаляем ненужный IAM Profile:
aws iam delete-instance-profile --instance-profile-name stg-artem-service-profile