Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: vault_kubernetes_secret_backend empty jwt when disable_local_ca_jwt true #2369

Closed
mikkel3000 opened this issue Nov 20, 2024 · 2 comments
Labels

Comments

@mikkel3000
Copy link

Terraform Core Version

1.9.2

Terraform Vault Provider Version

4.4.0

Vault Server Version

1.17.3

Affected Resource(s)

vault_kubernetes_secret_backend

Expected Behavior

When using vault_kubernetes_secret_backend with empty kubernetes_ca_cert = null and disable_local_ca_jwt = true the service account jwt should be populated, but is not.

Setting kubernetes secret backend with:

resource "vault_kubernetes_secret_backend" "vault-kubernetes-secret-backend" {
  count                = 1
  path                 = "kubernetes-example-cluster"
  kubernetes_host      = "https://cluster-api.example-cluster.myorg.com"
  kubernetes_ca_cert   = null
  service_account_jwt  = "EXAMPLEJWT"
  disable_local_ca_jwt = true
}

Expects to see.
image

Actual Behavior

Service Account JWT is empty.
I did not use "EXAMPLEJWT" when applying it, i used an actual service account jwt.
Gives following in vault ui:
image

Relevant Error/Panic Output Snippet

No errors, works fine from vault ui.

Terraform Configuration Files

resource "vault_kubernetes_secret_backend" "vault-kubernetes-secret-backend" {
  count                = 1
  path                 = "kubernetes-example-cluster"
  kubernetes_host      = "https://cluster-api.example-cluster.myorg.com"
  kubernetes_ca_cert   = null
  service_account_jwt  = "EXAMPLEJWT"
  disable_local_ca_jwt = true
}

Steps to Reproduce

Try to apply the terraform resource and observe the missing JWT.

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

@mikkel3000 mikkel3000 added the bug label Nov 20, 2024
@mikkel3000 mikkel3000 changed the title [Bug]: [Bug]: vault_kubernetes_secret_backend empty jwt when disable_local_ca_jwt true Nov 20, 2024
@fairclothjm
Copy link
Contributor

Hello @mikkel3000, I am sorry you are having trouble here.

I believe this is expected behavior. The service_account_jwt is not returned in the READ request from the kubernetes backend's /config endpoint so the UI will have no way of displaying it.

$ vault write -f kubernetes/config kubernetes_host=foo service_account_jwt="header.payload.signature"
Success! Data written to: kubernetes/config

$ vault read kubernetes/config
Key                     Value
---                     -----
disable_local_ca_jwt    false
kubernetes_ca_cert      n/a
kubernetes_host         foo

@mikkel3000
Copy link
Author

Ah, okay thanks. I guess something else must be the problem!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants