When executed, execute "terraform apply" during execution when creating the "IAM Profile", it ends with the following error:
* 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
Solution:
Use AWS Cli to find the IAM Profile and delete it.
aws --profile artem iam list-instance-profiles
See the list of existing IAM Profiles:
{ "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": [] } ] }
Remove unnecessary IAM Profile:
aws iam delete-instance-profile --instance-profile-name stg-artem-service-profile