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

Adding support for workspace secret per namespace #133

Open jtyr opened 2 years ago

jtyr commented 2 years ago

Community Note


This PR is adding the possibility to have workspacesecrets per namespace if the TFCO is run to watch all namespaces (when there is --k8s-watch-namespace=<namespace> command line option specified). This allows to have multiple teams, where each team occupies one namespace, to have their own secrets that are passed to Terraform. This PR needs to be rebased once the PR #129 is merged to remove most of the changes in the CRD.

The secret is referenced in the Workspace using the spec.secretName:

...
spec:
  secretName: mysecret
...

The secret referenced by with the spec.secretName must be located in the same namespace like the Workspace resource. Those secrets are merged with the workspace secret in the namespace where TFCO is installed and that is mounted into the container using the spec.secretsMountPath.

Release note for CHANGELOG:

Added support for workspace secret per namespace
jtyr commented 2 years ago

This PR is rebased now.