File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -3,12 +3,23 @@ locals {
33 Datadog = " true"
44 DatadogAgentlessScanner = " true"
55 }
6+ dd_tags_list = [for k , v in local . dd_tags : " ${ k } :${ v } " ]
67}
78
89data "aws_region" "current" {}
910
1011locals {
1112 api_key_secret_arn = var. api_key_secret_arn != null ? var. api_key_secret_arn : aws_secretsmanager_secret. api_key [0 ]. arn
13+ # Add custom tags to the agent configuration.
14+ custom_agent_configuration = merge (
15+ var. agent_configuration ,
16+ {
17+ tags = concat (
18+ lookup (var. agent_configuration , " tags" , []), # Safely get existing tags or default to an empty list
19+ local. dd_tags_list
20+ )
21+ }
22+ )
1223}
1324
1425resource "aws_secretsmanager_secret" "api_key" {
@@ -37,7 +48,7 @@ resource "terraform_data" "template" {
3748 scanner_version = var.scanner_version,
3849 scanner_channel = var.scanner_channel,
3950 scanner_configuration = var.scanner_configuration,
40- agent_configuration = var.agent_configuration ,
51+ agent_configuration = local.custom_agent_configuration ,
4152 region = data.aws_region.current.name,
4253 })
4354}
You can’t perform that action at this time.
0 commit comments