straubt1 / tfx

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

Feature Request: Show workspaces which the current workspace shares it's remote state file with #30

Closed rhughes1 closed 2 years ago

rhughes1 commented 2 years ago

Problem Statement

As part of listing workspace information, there should be a method of easily getting the names/IDs of workspace(s) which the current workspace shares it's Terraform state file with. This would prove useful for potential reporting or Terraform state importing purposes.

Ultimately we need the workspace ID and the workspace name to be displayed as well as if it's globally shared or not.

One method of doing achieving this feature would be to permanently adding the information to the tfx workspace show command. Another approach could be a feature flag which optionally shows the information like tfx workspace show -n test-workspace -rs/tfx workspace show -n test-workspace --remote-state where -rs stands for remote-state.

Specifications

tfx version: 0.1.0 Terraform Cloud or Terraform Enterprise: Terraform Cloud Terraform Enterprise Version: N/A Terraform Code Version: 1.2.4

straubt1 commented 2 years ago

Great suggestion @rhughes1! Let me proto out an option to get some thoughts!

straubt1 commented 2 years ago

Combining this PR for #29 for ease.

Adds the "Global State Sharing" attribute as well.

Example output:

workspace show -n tfx-test
Using config file: /Users/tstraub/.tfx.hcl
Show Workspace: tfx-test
ID:                   ws-VxepewkunumUbR9V
Terraform Version:    1.0.0
Execution Mode:       remote
Auto Apply:           false
Working Directory:    
Locked:               false
Global State Sharing: false
Current Run Id:       run-tNGxao7zMos5YrY1
Current Run Status:   errored
Current Run Created:  Sun Aug 21 16:40 2022
Team Access:          appteam-read,ws-outputs
Remote State Sharing: tfx-test-workspace-16,tfx-test-workspace-17
straubt1 commented 2 years ago

Decided not to (at this time) implement a flag to determine which options to display, rather always show this for every show command. May revisit in the future if API calls become too much.

straubt1 commented 2 years ago

41 changes the output into a more friendly list