I’m referencing existing secret versions in Secret manager by arn and creating string for parameter in secret manager with lookup.
I want to use both of them in the session’s secrets of my container_definitions.
sorted_secrets_vars = [
for key in local.sorted_secrets_keys :
{
name = key
valueFrom = "${data.aws_secretsmanager_secret.cofre.arn}:${lookup(local.secrets_as_map, key)}::"
}
]
sorted_parameters_vars = [
for key in local.sorted_parameters_keys :
{
name = key
valueFrom = "arn:aws:ssm:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:parameter${lookup(local.parameters_as_map, key)}"
}
]
final_secrets_vars = merge(local.final_parameters, local.final_secrets)
My dev.json (using workspace) has the following code:
{
"secrets": {
"SECRET_1": "SECRET1",
"SECRET_2": "SECRET2"
},
"parameters": {
"PARAMETER_1": "/dev/parameter1",
"PARAMETER_2": "/dev/parameter2"
}
}
With merge function I’m getting the following error:
│ │ local.final_parameters is tuple with 2 elements
│ │ local.final_secrets is tuple with 2 elements
│
│ Call to function "merge" failed: arguments must be maps or objects, got "tuple".
How can I join local.final_parameters with local.final_secrets and have something like this?
final_secret_vars = [
{
name = "PARAMETER_1"
valueFrom = "arn:aws:ssm:us-east-1:12345678901:parameter/dev/parameter1"
},
{
name = "PARAMETER_2"
valueFrom = "arn:aws:ssm:us-east-1:12345678901:parameter/dev/parameter2"
},
{
name = "SECRET_1"
valueFrom = "arn:aws:secretsmanager:us-east-1:1234567890:secret:/dev/secret-1abCde:SECRET1::"
},
{
name = "SECRET_2"
valueFrom = "arn:aws:secretsmanager:us-east-1:1234567890:secret:/dev/secret-1abCde:SECRET2::"
},
]