hashicorp / terraform-k8s

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

Use Existing Terraform Cloud Workspace #127

Open joshvermast opened 2 years ago

joshvermast commented 2 years ago

Community Note

Description

The ability to define a Terraform Cloud Workspace to be utilized by Terraform Cloud Operator instead of having it create it's own workspace. This would alleviate the problem of Admin level permission token being required for every instance of Terraform Cloud Operator.

There may have to be consideration taken that the targetted Workspace have no stored State at the time of binding to a TFCO CR.

Potential Terraform Configuration

---
apiVersion: app.terraform.io/v1alpha1
kind: Workspace
metadata:
  name: workspacename #May be changed to optional if workspaceID is provided below.
spec:
  organization: Finastra
  workspaceID: ws-iXXXXXXXXX #New Configuration to use existing workspaceID
  secretsMountPath: "/tmp/secrets"
  agentPoolID: apool-iXXXXXXXX
  module:
    source: "X"
    version: "0.0.1"