Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add terraformworkspaceid.py #143

Merged
merged 1 commit into from
May 20, 2024
Merged

Conversation

kyanny
Copy link
Collaborator

@kyanny kyanny commented May 20, 2024

@gm3dmo

Extract Terraform Workspace ID from gheboot output and append it to the environment JSON file.

This python script accepts input like below.

@kyanny
, :wave:
You've requested GHES 3.10.3 single-node resources in australiaeast on azure with setup.
You can follow your instance creation @ https://terraform.githubapp.com/app/ghes/workspaces/gheboot-kyanny-1716187058841/runs/run-PNAKUxRcwBjyNF1T. (If this is your first time launching a GHEBoot instance via Terraform you will need to log into Terraform Enterprise from the Okta tile before this link will work)
We've set the name of this request to gheboot-kyanny-1716187058841 and your Terraform workspace is: gheboot-kyanny-1716187058841 (ws-v8whx1M2tBoYcNeC) and we've used the key in position 0 in your profile in GitHub.com for SSH access to this instance.
Just FYI, the reqested instance(s) will expire on 2024-05-22.

It extracts Terraform Workspace ID (e.g. ws-v8whx1M2tBoYcNeC in the above example input) and append it to the environment JSON file.

Terraform Workspace ID is needed in later to run some chatops such as .gheboot change-ttl so having it in the environment JSON file would be a good idea.

The script is supposed to run after ghe2json.py. If ghe2json.py hasn't executed, the environment JSON file doesn't exist. So that this script will abort with exception.

This script is developed based on ghe2json.py so that there are duplicated function definitions. I will do a refactoring in later (extracts these utility functions into thepower.py)

Extract Terraform Workspace ID from gheboot output and append it to the environment JSON file.
@gm3dmo gm3dmo merged commit ed14114 into gm3dmo:main May 20, 2024
4 of 5 checks passed
@kyanny kyanny deleted the kyanny-terraformworkspaceid branch May 21, 2024 01:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants