Kubernetes_secret dynamic assertion


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 = [



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