Skip to content
Merged
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
16 changes: 16 additions & 0 deletions modules/eventbridge-event-bus/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,19 @@ output "schema_discovery" {
)
}
}

output "resource_group" {
description = "The resource group created to manage resources in this module."
value = merge(
{
enabled = var.resource_group.enabled && var.module_tags_enabled
},
(var.resource_group.enabled && var.module_tags_enabled
? {
arn = module.resource_group[0].arn
name = module.resource_group[0].name
}
: {}
)
)
Comment on lines +46 to +57

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better consistency in the module's output API, it's preferable for the resource_group output to always have the same shape, regardless of whether the resource group is enabled or not. This avoids consumers of the module having to check for the existence of the arn and name attributes.

You can achieve this by using a single conditional expression that returns a complete object with null values for arn and name when the resource group is disabled.

  value = (var.resource_group.enabled && var.module_tags_enabled
    ? {
      enabled = true
      arn     = module.resource_group[0].arn
      name    = module.resource_group[0].name
    }
    : {
      enabled = false
      arn     = null
      name    = null
    }
  )

}
10 changes: 5 additions & 5 deletions modules/eventbridge-event-bus/resource-group.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
locals {
resource_group_name = (var.resource_group_name != ""
? var.resource_group_name
resource_group_name = (var.resource_group.name != ""
? var.resource_group.name
: join(".", [
local.metadata.package,
local.metadata.module,
Expand All @@ -12,12 +12,12 @@ locals {

module "resource_group" {
source = "tedilabs/misc/aws//modules/resource-group"
version = "~> 0.10.0"
version = "~> 0.12.0"

count = (var.resource_group_enabled && var.module_tags_enabled) ? 1 : 0
count = (var.resource_group.enabled && var.module_tags_enabled) ? 1 : 0

name = local.resource_group_name
description = var.resource_group_description
description = var.resource_group.description

query = {
resource_tags = local.module_tags
Expand Down
32 changes: 15 additions & 17 deletions modules/eventbridge-event-bus/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -62,23 +62,21 @@ variable "module_tags_enabled" {
# Resource Group
###################################################

variable "resource_group_enabled" {
description = "(Optional) Whether to create Resource Group to find and group AWS resources which are created by this module."
type = bool
default = true
nullable = false
}

variable "resource_group_name" {
description = "(Optional) The name of Resource Group. A Resource Group name can have a maximum of 127 characters, including letters, numbers, hyphens, dots, and underscores. The name cannot start with `AWS` or `aws`."
type = string
default = ""
nullable = false
}

variable "resource_group_description" {
description = "(Optional) The description of Resource Group."
type = string
default = "Managed by Terraform."
nullable = false

variable "resource_group" {
description = <<EOF
(Optional) A configurations of Resource Group for this module. `resource_group` as defined below.
(Optional) `enabled` - Whether to create Resource Group to find and group AWS resources which are created by this module. Defaults to `true`.
(Optional) `name` - The name of Resource Group. A Resource Group name can have a maximum of 127 characters, including letters, numbers, hyphens, dots, and underscores. The name cannot start with `AWS` or `aws`. If not provided, a name will be generated using the module name and instance name.
(Optional) `description` - The description of Resource Group. Defaults to `Managed by Terraform.`.
EOF
Comment on lines +69 to +74

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The indentation within the description heredoc is inconsistent. The first line has two spaces of indentation, while the subsequent lines describing the object attributes have four. For better readability of the generated documentation, it's best to have consistent indentation. I suggest removing the leading spaces from the first line and using a two-space indent for the attribute descriptions.

  description = <<EOF
(Optional) A configurations of Resource Group for this module. `resource_group` as defined below.
  (Optional) `enabled` - Whether to create Resource Group to find and group AWS resources which are created by this module. Defaults to `true`.
  (Optional) `name` - The name of Resource Group. A Resource Group name can have a maximum of 127 characters, including letters, numbers, hyphens, dots, and underscores. The name cannot start with `AWS` or `aws`. If not provided, a name will be generated using the module name and instance name.
  (Optional) `description` - The description of Resource Group. Defaults to `Managed by Terraform.`.
EOF

type = object({
enabled = optional(bool, true)
name = optional(string, "")
description = optional(string, "Managed by Terraform.")
})
default = {}
nullable = false
}
16 changes: 16 additions & 0 deletions modules/eventbridge-rule/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,19 @@ output "aws_service_targets" {
}
}
}

output "resource_group" {
description = "The resource group created to manage resources in this module."
value = merge(
{
enabled = var.resource_group.enabled && var.module_tags_enabled
},
(var.resource_group.enabled && var.module_tags_enabled
? {
arn = module.resource_group[0].arn
name = module.resource_group[0].name
}
: {}
)
)
Comment on lines +129 to +140

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better consistency in the module's output API, it's preferable for the resource_group output to always have the same shape, regardless of whether the resource group is enabled or not. This avoids consumers of the module having to check for the existence of the arn and name attributes.

You can achieve this by using a single conditional expression that returns a complete object with null values for arn and name when the resource group is disabled.

  value = (var.resource_group.enabled && var.module_tags_enabled
    ? {
      enabled = true
      arn     = module.resource_group[0].arn
      name    = module.resource_group[0].name
    }
    : {
      enabled = false
      arn     = null
      name    = null
    }
  )

}
10 changes: 5 additions & 5 deletions modules/eventbridge-rule/resource-group.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
locals {
resource_group_name = (var.resource_group_name != ""
? var.resource_group_name
resource_group_name = (var.resource_group.name != ""
? var.resource_group.name
: join(".", [
local.metadata.package,
local.metadata.module,
Expand All @@ -13,12 +13,12 @@ locals {

module "resource_group" {
source = "tedilabs/misc/aws//modules/resource-group"
version = "~> 0.10.0"
version = "~> 0.12.0"

count = (var.resource_group_enabled && var.module_tags_enabled) ? 1 : 0
count = (var.resource_group.enabled && var.module_tags_enabled) ? 1 : 0

name = local.resource_group_name
description = var.resource_group_description
description = var.resource_group.description

query = {
resource_tags = local.module_tags
Expand Down
32 changes: 15 additions & 17 deletions modules/eventbridge-rule/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -340,23 +340,21 @@ variable "module_tags_enabled" {
# Resource Group
###################################################

variable "resource_group_enabled" {
description = "(Optional) Whether to create Resource Group to find and group AWS resources which are created by this module."
type = bool
default = true
nullable = false
}

variable "resource_group_name" {
description = "(Optional) The name of Resource Group. A Resource Group name can have a maximum of 127 characters, including letters, numbers, hyphens, dots, and underscores. The name cannot start with `AWS` or `aws`."
type = string
default = ""
nullable = false
}

variable "resource_group_description" {
description = "(Optional) The description of Resource Group."
type = string
default = "Managed by Terraform."
nullable = false

variable "resource_group" {
description = <<EOF
(Optional) A configurations of Resource Group for this module. `resource_group` as defined below.
(Optional) `enabled` - Whether to create Resource Group to find and group AWS resources which are created by this module. Defaults to `true`.
(Optional) `name` - The name of Resource Group. A Resource Group name can have a maximum of 127 characters, including letters, numbers, hyphens, dots, and underscores. The name cannot start with `AWS` or `aws`. If not provided, a name will be generated using the module name and instance name.
(Optional) `description` - The description of Resource Group. Defaults to `Managed by Terraform.`.
EOF
Comment on lines +347 to +352

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The indentation within the description heredoc is inconsistent. The first line has two spaces of indentation, while the subsequent lines describing the object attributes have four. For better readability of the generated documentation, it's best to have consistent indentation. I suggest removing the leading spaces from the first line and using a two-space indent for the attribute descriptions.

  description = <<EOF
(Optional) A configurations of Resource Group for this module. `resource_group` as defined below.
  (Optional) `enabled` - Whether to create Resource Group to find and group AWS resources which are created by this module. Defaults to `true`.
  (Optional) `name` - The name of Resource Group. A Resource Group name can have a maximum of 127 characters, including letters, numbers, hyphens, dots, and underscores. The name cannot start with `AWS` or `aws`. If not provided, a name will be generated using the module name and instance name.
  (Optional) `description` - The description of Resource Group. Defaults to `Managed by Terraform.`.
EOF

type = object({
enabled = optional(bool, true)
name = optional(string, "")
description = optional(string, "Managed by Terraform.")
})
default = {}
nullable = false
}
16 changes: 16 additions & 0 deletions modules/msk-cluster/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,19 @@ output "zookeeper_connections" {
tls = aws_msk_cluster.this.zookeeper_connect_string_tls
}
}

output "resource_group" {
description = "The resource group created to manage resources in this module."
value = merge(
{
enabled = var.resource_group.enabled && var.module_tags_enabled
},
(var.resource_group.enabled && var.module_tags_enabled
? {
arn = module.resource_group[0].arn
name = module.resource_group[0].name
}
: {}
)
)
Comment on lines +223 to +234

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better consistency in the module's output API, it's preferable for the resource_group output to always have the same shape, regardless of whether the resource group is enabled or not. This avoids consumers of the module having to check for the existence of the arn and name attributes.

You can achieve this by using a single conditional expression that returns a complete object with null values for arn and name when the resource group is disabled.

  value = (var.resource_group.enabled && var.module_tags_enabled
    ? {
      enabled = true
      arn     = module.resource_group[0].arn
      name    = module.resource_group[0].name
    }
    : {
      enabled = false
      arn     = null
      name    = null
    }
  )

}
10 changes: 5 additions & 5 deletions modules/msk-cluster/resource-group.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
locals {
resource_group_name = (var.resource_group_name != ""
? var.resource_group_name
resource_group_name = (var.resource_group.name != ""
? var.resource_group.name
: join(".", [
local.metadata.package,
local.metadata.module,
Expand All @@ -12,12 +12,12 @@ locals {

module "resource_group" {
source = "tedilabs/misc/aws//modules/resource-group"
version = "~> 0.10.0"
version = "~> 0.12.0"

count = (var.resource_group_enabled && var.module_tags_enabled) ? 1 : 0
count = (var.resource_group.enabled && var.module_tags_enabled) ? 1 : 0

name = local.resource_group_name
description = var.resource_group_description
description = var.resource_group.description

query = {
resource_tags = local.module_tags
Expand Down
32 changes: 15 additions & 17 deletions modules/msk-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -271,23 +271,21 @@ variable "module_tags_enabled" {
# Resource Group
###################################################

variable "resource_group_enabled" {
description = "(Optional) Whether to create Resource Group to find and group AWS resources which are created by this module."
type = bool
default = true
nullable = false
}

variable "resource_group_name" {
description = "(Optional) The name of Resource Group. A Resource Group name can have a maximum of 127 characters, including letters, numbers, hyphens, dots, and underscores. The name cannot start with `AWS` or `aws`."
type = string
default = ""
nullable = false
}

variable "resource_group_description" {
description = "(Optional) The description of Resource Group."
type = string
default = "Managed by Terraform."
nullable = false

variable "resource_group" {
description = <<EOF
(Optional) A configurations of Resource Group for this module. `resource_group` as defined below.
(Optional) `enabled` - Whether to create Resource Group to find and group AWS resources which are created by this module. Defaults to `true`.
(Optional) `name` - The name of Resource Group. A Resource Group name can have a maximum of 127 characters, including letters, numbers, hyphens, dots, and underscores. The name cannot start with `AWS` or `aws`. If not provided, a name will be generated using the module name and instance name.
(Optional) `description` - The description of Resource Group. Defaults to `Managed by Terraform.`.
EOF
Comment on lines +278 to +283

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The indentation within the description heredoc is inconsistent. The first line has two spaces of indentation, while the subsequent lines describing the object attributes have four. For better readability of the generated documentation, it's best to have consistent indentation. I suggest removing the leading spaces from the first line and using a two-space indent for the attribute descriptions.

  description = <<EOF
(Optional) A configurations of Resource Group for this module. `resource_group` as defined below.
  (Optional) `enabled` - Whether to create Resource Group to find and group AWS resources which are created by this module. Defaults to `true`.
  (Optional) `name` - The name of Resource Group. A Resource Group name can have a maximum of 127 characters, including letters, numbers, hyphens, dots, and underscores. The name cannot start with `AWS` or `aws`. If not provided, a name will be generated using the module name and instance name.
  (Optional) `description` - The description of Resource Group. Defaults to `Managed by Terraform.`.
EOF

type = object({
enabled = optional(bool, true)
name = optional(string, "")
description = optional(string, "Managed by Terraform.")
})
default = {}
nullable = false
}
17 changes: 16 additions & 1 deletion modules/ses-identity/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,19 @@ output "custom_mail_from" {
# k => v
# if !contains(["arn", "id", "email_identity", "identity_type", "tags", "tags_all", "dkim_signing_attributes", "verified_for_sending_status", "configuration_set_name"], k)
# }
# }
# }
output "resource_group" {
description = "The resource group created to manage resources in this module."
value = merge(
{
enabled = var.resource_group.enabled && var.module_tags_enabled
},
(var.resource_group.enabled && var.module_tags_enabled
? {
arn = module.resource_group[0].arn
name = module.resource_group[0].name
}
: {}
)
)
Comment on lines +89 to +100

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better consistency in the module's output API, it's preferable for the resource_group output to always have the same shape, regardless of whether the resource group is enabled or not. This avoids consumers of the module having to check for the existence of the arn and name attributes.

You can achieve this by using a single conditional expression that returns a complete object with null values for arn and name when the resource group is disabled.

  value = (var.resource_group.enabled && var.module_tags_enabled
    ? {
      enabled = true
      arn     = module.resource_group[0].arn
      name    = module.resource_group[0].name
    }
    : {
      enabled = false
      arn     = null
      name    = null
    }
  )

}
10 changes: 5 additions & 5 deletions modules/ses-identity/resource-group.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
locals {
resource_group_name = (var.resource_group_name != ""
? var.resource_group_name
resource_group_name = (var.resource_group.name != ""
? var.resource_group.name
: join(".", [
local.metadata.package,
local.metadata.module,
Expand All @@ -12,12 +12,12 @@ locals {

module "resource_group" {
source = "tedilabs/misc/aws//modules/resource-group"
version = "~> 0.10.0"
version = "~> 0.12.0"

count = (var.resource_group_enabled && var.module_tags_enabled) ? 1 : 0
count = (var.resource_group.enabled && var.module_tags_enabled) ? 1 : 0

name = local.resource_group_name
description = var.resource_group_description
description = var.resource_group.description

query = {
resource_tags = local.module_tags
Expand Down
32 changes: 15 additions & 17 deletions modules/ses-identity/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -134,23 +134,21 @@ variable "module_tags_enabled" {
# Resource Group
###################################################

variable "resource_group_enabled" {
description = "(Optional) Whether to create Resource Group to find and group AWS resources which are created by this module."
type = bool
default = true
nullable = false
}

variable "resource_group_name" {
description = "(Optional) The name of Resource Group. A Resource Group name can have a maximum of 127 characters, including letters, numbers, hyphens, dots, and underscores. The name cannot start with `AWS` or `aws`."
type = string
default = ""
nullable = false
}

variable "resource_group_description" {
description = "(Optional) The description of Resource Group."
type = string
default = "Managed by Terraform."
nullable = false

variable "resource_group" {
description = <<EOF
(Optional) A configurations of Resource Group for this module. `resource_group` as defined below.
(Optional) `enabled` - Whether to create Resource Group to find and group AWS resources which are created by this module. Defaults to `true`.
(Optional) `name` - The name of Resource Group. A Resource Group name can have a maximum of 127 characters, including letters, numbers, hyphens, dots, and underscores. The name cannot start with `AWS` or `aws`. If not provided, a name will be generated using the module name and instance name.
(Optional) `description` - The description of Resource Group. Defaults to `Managed by Terraform.`.
EOF
Comment on lines +141 to +146

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The indentation within the description heredoc is inconsistent. The first line has two spaces of indentation, while the subsequent lines describing the object attributes have four. For better readability of the generated documentation, it's best to have consistent indentation. I suggest removing the leading spaces from the first line and using a two-space indent for the attribute descriptions.

  description = <<EOF
(Optional) A configurations of Resource Group for this module. `resource_group` as defined below.
  (Optional) `enabled` - Whether to create Resource Group to find and group AWS resources which are created by this module. Defaults to `true`.
  (Optional) `name` - The name of Resource Group. A Resource Group name can have a maximum of 127 characters, including letters, numbers, hyphens, dots, and underscores. The name cannot start with `AWS` or `aws`. If not provided, a name will be generated using the module name and instance name.
  (Optional) `description` - The description of Resource Group. Defaults to `Managed by Terraform.`.
EOF

type = object({
enabled = optional(bool, true)
name = optional(string, "")
description = optional(string, "Managed by Terraform.")
})
default = {}
nullable = false
}
16 changes: 16 additions & 0 deletions modules/sns-fifo-topic/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,19 @@ output "zz" {
policy = aws_sns_topic_policy.this
}
}

output "resource_group" {
description = "The resource group created to manage resources in this module."
value = merge(
{
enabled = var.resource_group.enabled && var.module_tags_enabled
},
(var.resource_group.enabled && var.module_tags_enabled
? {
arn = module.resource_group[0].arn
name = module.resource_group[0].name
}
: {}
)
)
Comment on lines +72 to +83

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better consistency in the module's output API, it's preferable for the resource_group output to always have the same shape, regardless of whether the resource group is enabled or not. This avoids consumers of the module having to check for the existence of the arn and name attributes.

You can achieve this by using a single conditional expression that returns a complete object with null values for arn and name when the resource group is disabled.

  value = (var.resource_group.enabled && var.module_tags_enabled
    ? {
      enabled = true
      arn     = module.resource_group[0].arn
      name    = module.resource_group[0].name
    }
    : {
      enabled = false
      arn     = null
      name    = null
    }
  )

}
10 changes: 5 additions & 5 deletions modules/sns-fifo-topic/resource-group.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
locals {
resource_group_name = (var.resource_group_name != ""
? var.resource_group_name
resource_group_name = (var.resource_group.name != ""
? var.resource_group.name
: join(".", [
local.metadata.package,
local.metadata.module,
Expand All @@ -12,12 +12,12 @@ locals {

module "resource_group" {
source = "tedilabs/misc/aws//modules/resource-group"
version = "~> 0.10.0"
version = "~> 0.12.0"

count = (var.resource_group_enabled && var.module_tags_enabled) ? 1 : 0
count = (var.resource_group.enabled && var.module_tags_enabled) ? 1 : 0

name = local.resource_group_name
description = var.resource_group_description
description = var.resource_group.description

query = {
resource_tags = local.module_tags
Expand Down
Loading