Skip to content

feat: add aws_account_alias override #206

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions modules/config/alias.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
data "aws_iam_account_alias" "current" {
count = var.tag_account_alias ? 1 : 0
count = var.tag_account_alias && var.aws_account_alias == null ? 1 : 0
}

locals {
tags = var.tag_account_alias ? {
"observeinc.com/accountalias" = data.aws_iam_account_alias.current[0].account_alias
"observeinc.com/accountalias" = var.aws_account_alias == null ? data.aws_iam_account_alias.current[0].account_alias : var.aws_account_alias
} : {}
}
9 changes: 9 additions & 0 deletions modules/config/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ variable "sns_topic_arn" {
nullable = true
}

variable "aws_account_alias" {
description = <<-EOF
Override AWS account alias tag.
EOF
type = string
default = null
nullable = true
}

variable "tag_account_alias" {
type = bool
description = <<-EOF
Expand Down
4 changes: 2 additions & 2 deletions modules/configsubscription/alias.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
data "aws_iam_account_alias" "current" {
count = var.tag_account_alias ? 1 : 0
count = var.tag_account_alias && var.aws_account_alias == null ? 1 : 0
}

locals {
tags = var.tag_account_alias ? {
"observeinc.com/accountalias" = data.aws_iam_account_alias.current[0].account_alias
"observeinc.com/accountalias" = var.aws_account_alias == null ? data.aws_iam_account_alias.current[0].account_alias : var.aws_account_alias
} : {}
}
9 changes: 9 additions & 0 deletions modules/configsubscription/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ variable "name_prefix" {
nullable = false
}

variable "aws_account_alias" {
description = <<-EOF
Override AWS account alias tag.
EOF
type = string
default = null
nullable = true
}

variable "tag_account_alias" {
type = bool
description = <<-EOF
Expand Down
1 change: 1 addition & 0 deletions modules/stack/config.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module "config" {
delivery_frequency = var.config.delivery_frequency
include_global_resource_types = var.config.include_global_resource_types
tag_account_alias = var.config.tag_account_alias
aws_account_alias = var.config.aws_account_alias

depends_on = [aws_s3_bucket_notification.this]
}
1 change: 1 addition & 0 deletions modules/stack/configsubscription.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ module "configsubscription" {
target_arn = module.forwarder.queue_arn

tag_account_alias = var.configsubscription.tag_account_alias
aws_account_alias = var.configsubscription.aws_account_alias
}

2 changes: 2 additions & 0 deletions modules/stack/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ variable "config" {
delivery_frequency = optional(string)
include_global_resource_types = optional(bool)
tag_account_alias = optional(bool)
aws_account_alias = optional(string)
})
default = null
}
Expand All @@ -72,6 +73,7 @@ variable "configsubscription" {
type = object({
delivery_bucket_name = string
tag_account_alias = optional(bool)
aws_account_alias = optional(string)
})
default = null
}
Expand Down