Skip to content

Commit fb6c371

Browse files
committed
feat: add aws_account_alias override
1 parent 369e10d commit fb6c371

File tree

7 files changed

+26
-4
lines changed

7 files changed

+26
-4
lines changed

modules/config/alias.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
data "aws_iam_account_alias" "current" {
2-
count = var.tag_account_alias ? 1 : 0
2+
count = var.tag_account_alias && var.aws_account_alias == null ? 1 : 0
33
}
44

55
locals {
66
tags = var.tag_account_alias ? {
7-
"observeinc.com/accountalias" = data.aws_iam_account_alias.current[0].account_alias
7+
"observeinc.com/accountalias" = var.aws_account_alias == null ? data.aws_iam_account_alias.current[0].account_alias : var.aws_account_alias
88
} : {}
99
}

modules/config/variables.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,15 @@ variable "sns_topic_arn" {
8080
nullable = true
8181
}
8282

83+
variable "aws_account_alias" {
84+
description = <<-EOF
85+
Override AWS account alias tag.
86+
EOF
87+
type = string
88+
default = null
89+
nullable = true
90+
}
91+
8392
variable "tag_account_alias" {
8493
type = bool
8594
description = <<-EOF

modules/configsubscription/alias.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
data "aws_iam_account_alias" "current" {
2-
count = var.tag_account_alias ? 1 : 0
2+
count = var.tag_account_alias && var.aws_account_alias == null ? 1 : 0
33
}
44

55
locals {
66
tags = var.tag_account_alias ? {
7-
"observeinc.com/accountalias" = data.aws_iam_account_alias.current[0].account_alias
7+
"observeinc.com/accountalias" = var.aws_account_alias == null ? data.aws_iam_account_alias.current[0].account_alias : var.aws_account_alias
88
} : {}
99
}

modules/configsubscription/variables.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ variable "name_prefix" {
1414
nullable = false
1515
}
1616

17+
variable "aws_account_alias" {
18+
description = <<-EOF
19+
Override AWS account alias tag.
20+
EOF
21+
type = string
22+
default = null
23+
nullable = true
24+
}
25+
1726
variable "tag_account_alias" {
1827
type = bool
1928
description = <<-EOF

modules/stack/config.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ module "config" {
1111
delivery_frequency = var.config.delivery_frequency
1212
include_global_resource_types = var.config.include_global_resource_types
1313
tag_account_alias = var.config.tag_account_alias
14+
aws_account_alias = var.config.aws_account_alias
1415

1516
depends_on = [aws_s3_bucket_notification.this]
1617
}

modules/stack/configsubscription.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ module "configsubscription" {
66
target_arn = module.forwarder.queue_arn
77

88
tag_account_alias = var.configsubscription.tag_account_alias
9+
aws_account_alias = var.configsubscription.aws_account_alias
910
}
1011

modules/stack/variables.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ variable "config" {
6161
delivery_frequency = optional(string)
6262
include_global_resource_types = optional(bool)
6363
tag_account_alias = optional(bool)
64+
aws_account_alias = optional(string)
6465
})
6566
default = null
6667
}
@@ -72,6 +73,7 @@ variable "configsubscription" {
7273
type = object({
7374
delivery_bucket_name = string
7475
tag_account_alias = optional(bool)
76+
aws_account_alias = optional(string)
7577
})
7678
default = null
7779
}

0 commit comments

Comments
 (0)