{"id":1105,"date":"2019-05-20T13:52:08","date_gmt":"2019-05-20T10:52:08","guid":{"rendered":"https:\/\/artem.services\/?p=1103"},"modified":"2019-05-20T14:02:41","modified_gmt":"2019-05-20T11:02:41","slug":"fix-error-terraform-instance-profile-already-exists-2","status":"publish","type":"post","link":"https:\/\/artem.services\/?p=1105&lang=en","title":{"rendered":"FIX ERROR &#8212; Terraform: Instance Profile already exists"},"content":{"rendered":"<p><span class=\"tlid-translation translation\" lang=\"en\"><span class=\"\" title=\"\">When executed, execute &quot;<strong>terraform apply<\/strong>&quot; during execution when creating the &quot;<strong>IAM Profile<\/strong>&quot;, it ends with the following error:<\/span><\/span><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n\t* aws_iam_instance_profile.ecs_profile: 1 error occurred:\r\n\t* aws_iam_instance_profile.ecs_profile: Error creating IAM instance profile stg-artem-service-profile: EntityAlreadyExists: Instance Profile stg-artem-service-profile already exists.\r\n\tstatus code: 409, request id: a77fec43-7ad2-11e9-9e4e-7744dbc7b890\r\n<\/pre>\n<p>&nbsp;<\/p>\n<h3>Solution:<\/h3>\n<p><span class=\"tlid-translation translation\" lang=\"en\"><span class=\"\" title=\"\">Use <strong>AWS Cli<\/strong> to find the <strong>IAM Profile<\/strong> and delete it.<\/span><\/span><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\naws --profile artem iam list-instance-profiles\r\n<\/pre>\n<p><span class=\"tlid-translation translation\" lang=\"en\"><span class=\"\" title=\"\">See the list of existing <strong>IAM Profiles<\/strong>:<\/span><\/span><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n{\r\n    &quot;InstanceProfiles&quot;: [\r\n        {\r\n            &quot;Path&quot;: &quot;\/&quot;,\r\n            &quot;InstanceProfileName&quot;: &quot;stg-artem-service-profile&quot;,\r\n            &quot;InstanceProfileId&quot;: &quot;YYYYYYYYYYYYYYYYYYYYY&quot;,\r\n            &quot;Arn&quot;: &quot;arn:aws:iam::XXXXXXXXXXXX:instance-profile\/stg-artem-service-profile&quot;,\r\n            &quot;CreateDate&quot;: &quot;2019-05-17T14:06:27Z&quot;,\r\n            &quot;Roles&quot;: []\r\n        }\r\n    ]\r\n}\r\n<\/pre>\n<p><span class=\"tlid-translation translation\" lang=\"en\"><span class=\"\" title=\"\">Remove unnecessary <strong>IAM Profile<\/strong>:<\/span><\/span><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\naws iam delete-instance-profile --instance-profile-name stg-artem-service-profile\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>When executed, execute &quot;terraform apply&quot; during execution when creating the &quot;IAM Profile&quot;, it ends with the following error: &nbsp; Solution: Use AWS Cli to find the IAM Profile and delete it. See the list of existing IAM Profiles: Remove unnecessary IAM Profile:<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[357],"tags":[543,361,365,839,555],"_links":{"self":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/1105"}],"collection":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1105"}],"version-history":[{"count":2,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/1105\/revisions"}],"predecessor-version":[{"id":1107,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/1105\/revisions\/1107"}],"wp:attachment":[{"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1105"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1105"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1105"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}