{"action":"created","issue":{"url":"https://api.github.com/repos/mitchellh/packer/issues/1873","labels_url":"https://api.github.com/repos/mitchellh/packer/issues/1873/labels{/name}","comments_url":"https://api.github.com/repos/mitchellh/packer/issues/1873/comments","events_url":"https://api.github.com/repos/mitchellh/packer/issues/1873/events","html_url":"https://github.com/mitchellh/packer/issues/1873","id":55528932,"number":1873,"title":"AMI builder: add boolean option for automatic deregistration","user":{"login":"mfischer-zd","id":984199,"avatar_url":"https://avatars.githubusercontent.com/u/984199?v=3","gravatar_id":"","url":"https://api.github.com/users/mfischer-zd","html_url":"https://github.com/mfischer-zd","followers_url":"https://api.github.com/users/mfischer-zd/followers","following_url":"https://api.github.com/users/mfischer-zd/following{/other_user}","gists_url":"https://api.github.com/users/mfischer-zd/gists{/gist_id}","starred_url":"https://api.github.com/users/mfischer-zd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mfischer-zd/subscriptions","organizations_url":"https://api.github.com/users/mfischer-zd/orgs","repos_url":"https://api.github.com/users/mfischer-zd/repos","events_url":"https://api.github.com/users/mfischer-zd/events{/privacy}","received_events_url":"https://api.github.com/users/mfischer-zd/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-01-26T19:53:58Z","updated_at":"2015-02-25T00:30:59Z","closed_at":null,"body":"It would be useful if an AMI builder specification could have a boolean option to deregister an existing AMI having the same name, provided the build was otherwise successful.  This would make it easy to replace existing AMIs if the AMI name doesn't change between releases.\r\n\r\nBefore you say \"do this outside packer\":\r\n\r\n1. If it's done before the Packer build runs, an unsuccessful build will leave you without a working AMI.\r\n2. AMI names can come from templates and `packer inspect` is of no help here.  Here's a particularly complex example: \r\n\r\n```\r\n{\r\n   \"ami_name\": \"{{if eq (len (user `ami_name`)) 0}}ubuntu_12.04_base{{else}}{{user `ami_name`}}{{end}}\"\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/mitchellh/packer/issues/comments/75881674","html_url":"https://github.com/mitchellh/packer/issues/1873#issuecomment-75881674","issue_url":"https://api.github.com/repos/mitchellh/packer/issues/1873","id":75881674,"user":{"login":"sethvargo","id":408570,"avatar_url":"https://avatars.githubusercontent.com/u/408570?v=3","gravatar_id":"","url":"https://api.github.com/users/sethvargo","html_url":"https://github.com/sethvargo","followers_url":"https://api.github.com/users/sethvargo/followers","following_url":"https://api.github.com/users/sethvargo/following{/other_user}","gists_url":"https://api.github.com/users/sethvargo/gists{/gist_id}","starred_url":"https://api.github.com/users/sethvargo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sethvargo/subscriptions","organizations_url":"https://api.github.com/users/sethvargo/orgs","repos_url":"https://api.github.com/users/sethvargo/repos","events_url":"https://api.github.com/users/sethvargo/events{/privacy}","received_events_url":"https://api.github.com/users/sethvargo/received_events","type":"User","site_admin":false},"created_at":"2015-02-25T00:30:59Z","updated_at":"2015-02-25T00:30:59Z","body":"Kinda related to https://github.com/mitchellh/packer/issues/1774"}}