Hi
Can someone help me to construct dynamic data for kubernetes_secret function?
Currently, I have a local var with a list of strings, which are values for ssm parameters.
locals {
ssm_credentials = [
"root_user_login",
"root_user_password",
"admin-username",
"admin-password",
"support-username",
"support-password"
]
}
I would like to construct data for the kubernetes_secret where every string from locals will be the name of the secret, and then also every value of the name will be data.aws_ssm_parameter.general_ssm_creds.every string from locals, e.g.
resource "kubernetes_secret" "user_secrets" {
metadata {
name = "user-secrets"
}
data = {
"root_user_login" = data.aws_ssm_parameter.general_ssm_creds["root_user_login"].value
"root_user_password" = data.aws_ssm_parameter.general_ssm_creds["root_user_password"].value
}
}