Skip to content

Commit

Permalink
FEATURE: Add variable to support extra aws resource tag for asg (#150)
Browse files Browse the repository at this point in the history
Co-authored-by: tom <tom@maicoin.com>
  • Loading branch information
smalltown and smalltown authored Aug 25, 2022
1 parent a4d9cd1 commit e4f9f42
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modules/aws/kube-worker/main.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
locals {
vpc_id = data.aws_subnet.subnet.vpc_id

asg_extra_tags = [for k, v in var.extra_tags : { key = k, value = v, propagate_at_launch = true } if k != "Name"]

iops_by_type = {
root = {
"gp3" : max(3000, var.instance_config["root_volume_iops"]),
Expand Down Expand Up @@ -95,7 +93,9 @@ resource "aws_autoscaling_group" "worker" {
}

dynamic "tag" {
for_each = merge(var.extra_tags,
for_each = merge(
var.extra_tags,
var.extra_asg_tags,
{
"Name" = "${var.name}-worker-${var.instance_config["name"]}"
"Role" = "k8s-worker"
Expand Down
6 changes: 6 additions & 0 deletions modules/aws/kube-worker/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,12 @@ variable "extra_tags" {
default = {}
}

variable "extra_asg_tags" {
description = "Extra AWS tags to be applied to K8s worker group auto scaling group."
type = map(string)
default = {}
}

variable "enable_extra_sg" {
description = "Enable extra security group for worker group."
type = bool
Expand Down

0 comments on commit e4f9f42

Please sign in to comment.