hashicorp / terraform-cloud-operator

Kubernetes Operator allows managing HCP Terraform resources via Kubernetes Custom Resources.
https://developer.hashicorp.com/terraform/cloud-docs
Mozilla Public License 2.0
114 stars 27 forks source link

🚀 Add Initial Run #360

Open Pale-whale opened 4 months ago

Pale-whale commented 4 months ago

Description

This pr adds the ability to queue an initial run at the workspace creation It adds two fields:

spec:
  initialRun: <true|false>
  initialRunType: <plan|apply>

I went with two variables because we often overrides helm variables and setting a value to false in a chart is easier than removing it completely.

I added functions to wait that the workspace is uploaded, variables too and a new run is needed and then start a new run. I have little to no experience in kubernetes operator development so it may be the wrong logic here.

Usage Example

spec:
  initialRun: true
  initialRunType: apply

Will queue an apply run when the workspace is created and all the variables are uploaded

References

Community Note