packer-plugin-amazon icon indicating copy to clipboard operation
packer-plugin-amazon copied to clipboard

Provide way of unsetting run tags on AMI

Open frh-td opened this issue 2 years ago • 0 comments

We have some scripts running on our instances that we don't want to run on the instances being used to create AMIs. We've been detecting if the instance is a packer-launched instance by setting a specific instance tag in run_tags, then checking for the presence of this tag in those scripts, and aborting if present.

With https://github.com/hashicorp/packer-plugin-amazon/pull/327 those tags end up also being set on the created AMIs, which is undesirable. I tried to see if I could unset a tag from run_tags by setting it to null in tags, but it aborted saying "Error: null value is not allowed".

Is it possible to allow unsetting a run tag on the created AMI, or is there perhaps some alternative way for a process to determine if the instance it is running on is a Packer-created instance? Alternative solutions we have come up with so far are to use the value of a tag that we set differently in run_tags and tags (like Name), or to pass a value through user data.

frh-td avatar Apr 12 '23 11:04 frh-td