Skip to content

Commit 4c45618

Browse files
committed
fix: asg resource does not automatically add the default_tags from the AWS provider
1 parent 0e0452f commit 4c45618

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

_data.tf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,6 @@ data "aws_subnet" "subnets" {
1414
id = var.elb_subnets[count.index]
1515
}
1616

17-
data "aws_region" "current" {}
17+
data "aws_region" "current" {}
18+
19+
data "aws_default_tags" "current" {}

asg.tf

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
locals {
2+
all_tags = merge(
3+
data.aws_default_tags.current.tags,
4+
var.tags
5+
)
6+
}
7+
18
resource "aws_autoscaling_group" "bastion_auto_scaling_group" {
29
name_prefix = "asg-${var.bastion_name}"
310
max_size = var.bastion_instance_count
@@ -23,7 +30,7 @@ resource "aws_autoscaling_group" "bastion_auto_scaling_group" {
2330
}
2431

2532
dynamic "tag" {
26-
for_each = var.tags
33+
for_each = local.all_tags
2734

2835
content {
2936
key = tag.key

0 commit comments

Comments
 (0)