hashicorp / terraform-aws-consul

A Terraform Module for how to run Consul on AWS using Terraform and Packer
Apache License 2.0
401 stars 484 forks source link

EBS volumes generated for instances should receive tags #96

Open pwong-workday opened 5 years ago

pwong-workday commented 5 years ago

My team is using a mixture of hashicorp/terraform-aws-consul, hashicorp/terraform-aws-vault, and our own modules for all other types of instances. We noticed that EBS volumes generated for Consul and Vault instances do not get any tags, so they show up in the UI as having no name. Consequently, it is more difficult to determine at a glance if they are legitimate or actively-used volumes.

For our own modules, we use aws_launch_template rather than aws_launch_configuration, and we put tag_specifications blocks within them like so:

  tag_specifications {
    resource_type = "instance"

    tags {
      Name = "${var....}"
    }
  }

  tag_specifications {
    resource_type = "volume"

    tags {
      Name = "${var....}"
    }
  }

The Terraform docs suggest that the tag_specifications feature is exclusive to aws_launch_template although I hope that you may be able to determine some way to get the same thing in aws_launch_configuration as well.

brikis98 commented 5 years ago

There's no way in Terraform to tag EBS volumes in an ASG with a launch configuration. The only options are:

  1. Move to launch templates. This would be a significant, backwards incompatible change.
  2. Use a script (e.g., User Data) to tag the EBS Volumes while the server is booting.