From 52286a00653cf695835ec4c22dc090417358bf21 Mon Sep 17 00:00:00 2001 From: Sergiu Plotnicu <33776238+sppwf@users.noreply.github.com> Date: Tue, 30 Jul 2019 16:17:49 +0300 Subject: [PATCH] Support for tagging EBS Volumes created by "workers_launch_template*.tf" (#450) * Added support to tag EBS volumes used by EKS nodes created by workers_launch_template*.tf * Did terraform fmt on workers_launch_template*.tf --- CHANGELOG.md | 1 + workers_launch_template.tf | 15 +++++++++++++++ workers_launch_template_mixed.tf | 15 +++++++++++++++ 3 files changed, 31 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02eee5d..e38c115 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ project adheres to [Semantic Versioning](http://semver.org/). - Output the name of the cloudwatch log group (by @gbooth27) - Option to use spot instances with launch templates without defining pools, especially useful for GPU instance types (@onur-sam-gtn-ai) - Added `cpu_credits` param for the workers defined in `worker_groups_launch_template` (by @a-shink) + - Added support for EBS Volumes tag in `worker_groups_launch_template` and `workers_launch_template_mixed.tf` (by @sppwf) - Write your awesome addition here (by @you) ### Changed diff --git a/workers_launch_template.tf b/workers_launch_template.tf index caee563..1c4fe77 100644 --- a/workers_launch_template.tf +++ b/workers_launch_template.tf @@ -274,6 +274,21 @@ resource "aws_launch_template" "workers_launch_template" { } } + tag_specifications { + resource_type = "volume" + + tags = merge( + { + "Name" = "${aws_eks_cluster.this.name}-${lookup( + var.worker_groups_launch_template[count.index], + "name", + count.index, + )}-eks_asg" + }, + var.tags, + ) + } + tags = var.tags lifecycle { diff --git a/workers_launch_template_mixed.tf b/workers_launch_template_mixed.tf index 7dd9d90..6e1d620 100644 --- a/workers_launch_template_mixed.tf +++ b/workers_launch_template_mixed.tf @@ -316,6 +316,21 @@ resource "aws_launch_template" "workers_launch_template_mixed" { } } + tag_specifications { + resource_type = "volume" + + tags = merge( + { + "Name" = "${aws_eks_cluster.this.name}-${lookup( + var.worker_groups_launch_template[count.index], + "name", + count.index, + )}-eks_asg" + }, + var.tags, + ) + } + tags = var.tags lifecycle {