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

Reconcile Workspace does not update status.runStatus #143

Closed andreas-marneris-kidsloop closed 1 year ago

andreas-marneris-kidsloop commented 2 years ago

Community Note

terraform-k8s & Kubernetes Version

terraform-k8s: 1.1.0 Kubernetes: 1.21

Expected Behavior

When the operator pod performs a workspace reconciliation because, for example, a run occurred directly in terraform cloud, the operator should update the status.runStatus to match the new status in terraform cloud.

Actual Behavior

The operator syncs correctly the new runID but does not touch the runStatus. I believe the relevant section is in the workspace_helper.go here

Arguably, without a change to the underlying terraform module the workspace is running, the status should not change significantly, but it would be good to reflect accurately the terraform cloud status.

Steps to Reproduce

Create a workspace via the operator, which results in an "applied" status. Go to terraform cloud and trigger a manual run. Terraform cloud generates a new run id and eventually the status becomes planned and finished. The operator updates the run id but the status remains "applied".