straubt1 / tfx

TFx is a standalone CLI for Terraform Cloud and Terraform Enterprise.
MIT License
87 stars 15 forks source link

Feature Request: tfx workspace --drift-detect [on|off] [workspace|list of workspaces] #117

Open carljavier opened 4 months ago

carljavier commented 4 months ago

Background/Reason

Recently I have imported a bunch of Azure resources into TFC workspaces. These TFC workspaces were created on the fly and not as code as part of the import procedure. After the semi automated import procedure, we had many (25 - 50) workspaces to turn on drift detection. Have been manually turning on drift every wave of imports we do. Didn't seem like there was a seperate TF resource to turn it on per workspace (unlike notifications)

I have a lot had a situation i had to turn OFF a bunch of health assessments because the workspaces were configured to use a TFC cloud agent hosted on prem which was undersized. To allow other TF runs to run, we would have to turn off health assesments for all the workspaces using the cloud agent.

Example command/s

tfx workspace --drift-detect=[on|off] [workspace|workspace list]

other manual tasks we've had to do was set the VCS connection. This is another one that's only able to set via terraform on creation of a workspace.

maybe the following would work too since the API to updating/path a workspace is a json update

tfx workspace --vcs-repo [repo-name] [workspace]

Proper way to do this

If time permitted, i would import/get under TF management the TFC workspaces and just set them , but this was a time limited project to quickly import resources and get them under terraform management.

straubt1 commented 3 months ago

This is a great idea!