community.aws icon indicating copy to clipboard operation
community.aws copied to clipboard

ec2_launch_template: Allow tags for just instance or volume

Open leedm777 opened this issue 4 years ago • 3 comments

SUMMARY

The current tags option will set the tags on both the instances and volumes created by the launch template. The interferes with use by EC2 Fleet, and generally it would be better if we could specify tags for instances and volumes independently.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

ec2_launch_template

ADDITIONAL INFORMATION

Launch templates that tag volumes, unfortunately, does not work with EC2 Fleet. The policy for the AWSServiceRoleForEC2Fleet service role does not have permission to create tags on volumes (and both the policy and role are not editable, so the permission cannot be granted). The net effect is that if you use Ansible to create the launch template, and you use tags, then you can't use that launch template with EC2 Fleet.

I'm thinking that new instance_tags and volume_tags could be added to tag instances and volumes independently.

- name: Create an ec2 launch template with tags on instances and volumes
  ec2_launch_template:
    name: "my_template"
    image_id: "ami-04b762b4289fba92b"
    key_name: my_ssh_key
    instance_type: t2.micro
    iam_instance_profile: myTestProfile
    instance_tags:
      Name: some_instance
    volume_tags:
      Purpose: some_storage

leedm777 avatar Apr 23 '20 00:04 leedm777

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibullbot avatar Aug 19 '20 23:08 ansibullbot

cc @jillr @s-hertel @tremble @wimnat click here for bot help

ansibullbot avatar Aug 19 '20 23:08 ansibullbot

A new parameter tags_resource_type must be introduced.

https://github.com/ansible-collections/community.aws/blob/main/plugins/modules/ec2_launch_template.py#L456-L459

markuman avatar Jan 27 '22 20:01 markuman