generated from ministryofjustice/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 290
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8095 from ministryofjustice/feature/7607-core-sec…
…urity-resolver-logs Log R53 resolver queries for `core-security`
- Loading branch information
Showing
3 changed files
with
30 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
locals { | ||
resolver_query_log_config_names = toset(["core-logging-rlq-cloudwatch", "core-logging-rlq-s3"]) | ||
vpc_ids = { for key, value in module.vpc : key => value["vpc_id"] if key == "live_data" } | ||
rlq_ids = { for name, config in data.aws_route53_resolver_query_log_config.core_logging : name => config.id } | ||
vpc_rlq_associations = merge([ | ||
for vpc_key, vpc_id in local.vpc_ids : { | ||
for rlq_name, rlq_id in local.rlq_ids : | ||
"${vpc_key}_${rlq_name}" => { | ||
vpc_id = vpc_id | ||
rlq_id = rlq_id | ||
} | ||
} | ||
]...) | ||
} | ||
|
||
data "aws_route53_resolver_query_log_config" "core_logging" { | ||
for_each = local.resolver_query_log_config_names | ||
filter { | ||
name = "Name" | ||
values = [each.value] | ||
} | ||
} | ||
|
||
resource "aws_route53_resolver_query_log_config_association" "core_logging" { | ||
for_each = local.is-production ? local.vpc_rlq_associations : {} | ||
resolver_query_log_config_id = each.value.rlq_id | ||
resource_id = each.value.vpc_id | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters