-
-
Notifications
You must be signed in to change notification settings - Fork 4
feat: improve how to use resource_group in modules #61
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -65,3 +65,19 @@ output "import_trail_events_iam_role" { | |
| } | ||
| ]) | ||
| } | ||
|
|
||
| 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
+71
to
+82
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -83,3 +83,19 @@ output "insight_event" { | |
| # if !contains(["id", "arn", "name", "enable_logging", "home_region", "s3_bucket_name", "s3_key_prefix", "enable_log_file_validation", "kms_key_id", "sns_topic_name", "cloud_watch_logs_group_arn", "tags", "tags_all", "is_multi_region_trail", "is_organization_trail", "include_global_service_events", "insight_selector", "event_selector", "advanced_event_selector"], 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -86,3 +86,19 @@ output "excluded_accounts" { | |
| description = "A list of AWS account identifiers excluded from the rule." | ||
| value = try(aws_config_organization_managed_rule.this[0].excluded_accounts, []) | ||
| } | ||
|
|
||
| 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
+92
to
+103
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -123,3 +123,19 @@ output "organization_aggregation" { | |
| : null | ||
| ) | ||
| } | ||
|
|
||
| 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
mergefunction with a ternary operator to conditionally add keys works, but it can be simplified. Using a single ternary expression for the entirevaluemakes the intent clearer and the code more concise.