hashicorp / terraform-k8s

Terraform Cloud Operator for Kubernetes
https://learn.hashicorp.com/tutorials/terraform/kubernetes-operator?in=terraform/kubernetes
Mozilla Public License 2.0
455 stars 71 forks source link

Support for secrets from Azure KeyVault (and potentially other secret management backends) #140

Open OlegGorj opened 2 years ago

OlegGorj commented 2 years ago

Community Note

Description

At this time, the only possibility to manage secrets as via K8s secrets and referenced in CRD. We're looking to expand the secrets management capabilities to include reading secrets from Azure KeyVaults.

Potential Terraform Configuration

The proposed change could take a form as part of CRD manifest as the following:

---
apiVersion: app.terraform.io/v1alpha1
kind: Workspace
metadata:
  name: salutations
  azurekeyvault: my-key-vault.vault.azure.net   <--- here, specify the name of KV
spec:
  organization: hashicorp-team-demo
  module:
    source: "git::https://github.com/mygit/queues.git"
  variables:
    - key: application
      value: azurekeyvault@my-secret    <-- here, reference KV and secret name
      sensitive: true
      environmentVariable: false

Variable behaviour goes as: 1) if value not specified as part of the block - usual route: read secret's value from k8s secret 2) if value specified as part of the block (i.e. value: azurekeyvault@my-secret ) parse it and pull the secret from specified secrets back-end, in this case azurekeyvault. This could be expanded further to support multiple back-ends such as AWS KMS, HC Vault, etc.

References

n/a

thereallukl commented 2 years ago

@OlegGorj please take a look at https://secrets-store-csi-driver.sigs.k8s.io/ I believe it solves your exact problem.

F21 commented 1 year ago

I would also like to see this with support for Vault, having spent the last day or so trying to get this working in a POC with the Vault CSI driver.

Here's what I want to do:

I tried the following:

Problem: