How to use templated policy in k8s?

I want to use templated policy based on namespace and described via terraform.
Like this:
test-policy = {
paths("{{identity.entity.aliases.accessor.metadata…)
}

Where i can find this accessor in tf to put it to the template?
Or how to access to first element of aliases in template?

It looks like you’re referring to Vault policy template expressions as described at https://www.vaultproject.io/docs/concepts/policies#templated-policies

These do not support access to aliases using numeric indexes.

You could retrieve the accessor via the data source described at https://registry.terraform.io/providers/hashicorp/vault/latest/docs/data-sources/auth_backend

1 Like