Skip to content

Instantly share code, notes, and snippets.

@OldCrowEW
Forked from kevincloud/tfsentinel-6.groovy
Created July 20, 2020 03:04
Show Gist options
  • Save OldCrowEW/a52ff28724f7fd0f5f822b9d70c47b46 to your computer and use it in GitHub Desktop.
Save OldCrowEW/a52ff28724f7fd0f5f822b9d70c47b46 to your computer and use it in GitHub Desktop.
def getWorkspaceId() {
def response = httpRequest(
customHeaders: [
[ name: "Authorization", value: "Bearer " + env.BEARER_TOKEN ],
[ name: "Content-Type", value: "application/vnd.api+json" ]
],
url: "https://app.terraform.io/api/v2/organizations/" + env.TF_ORGNAME + "/workspaces/" + env.TF_WORKSPACE
)
def data = new JsonSlurper().parseText(response.content)
return data.data.id
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment