diff --git a/tf/bao-policies.tf b/tf/bao-policies.tf index 4c845dc..c6ef59b 100644 --- a/tf/bao-policies.tf +++ b/tf/bao-policies.tf @@ -1,5 +1,5 @@ -resource "vault_policy" "k8s_default_sa" { +resource "vault_policy" "k8s_default" { name = "k8s-default-sa" - policy = file("bao-policies/k8s-default-sa.hcl") + policy = templatefile("bao-policies/k8s-default.hcl", { k8s_auth_backend = vault_auth_backend.kubernetes.accessor }) } diff --git a/tf/bao-policies/k8s-default-sa.hcl b/tf/bao-policies/k8s-default-sa.hcl deleted file mode 100644 index 4b36341..0000000 --- a/tf/bao-policies/k8s-default-sa.hcl +++ /dev/null @@ -1,3 +0,0 @@ -path "test-kv/data/{{identity.entity.aliases.auth_kubernetes_6872b6a9.metadata.service_account_namespace}}/*" { - capabilities = ["read"] -} diff --git a/tf/bao-policies/k8s-default.hcl b/tf/bao-policies/k8s-default.hcl new file mode 100644 index 0000000..51c4e23 --- /dev/null +++ b/tf/bao-policies/k8s-default.hcl @@ -0,0 +1,3 @@ +path "test-kv/data/{{identity.entity.aliases.${k8s_auth_backend}.metadata.service_account_namespace}}/*" { + capabilities = ["read"] +} diff --git a/tf/providers.tf b/tf/providers.tf index 6b05dc3..ae5935b 100644 --- a/tf/providers.tf +++ b/tf/providers.tf @@ -7,8 +7,4 @@ data "terraform_remote_state" "foo" { } } -provider "vault" { - # This will default to using $VAULT_ADDR - # But can be set explicitly - # address = "https://vault.example.net:8200" -} +provider "vault" {}