Skip to content

Instantly share code, notes, and snippets.

@OldCrowEW
Forked from kevincloud/tfsentinel-4.groovy
Created July 20, 2020 03:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OldCrowEW/50ebfd2b27e42514c9140ae3fd0d3caf to your computer and use it in GitHub Desktop.
Save OldCrowEW/50ebfd2b27e42514c9140ae3fd0d3caf to your computer and use it in GitHub Desktop.
def startPlan() {
def payload = buildPayload()
def response = httpRequest(
customHeaders: [
[ name: "Authorization", value: "Bearer " + env.BEARER_TOKEN ],
[ name: "Content-Type", value: "application/vnd.api+json" ]
],
httpMode: 'POST',
requestBody: "${payload}",
url: "https://app.terraform.io/api/v2/runs"
)
def data = new JsonSlurper().parseText(response.content)
println ("Run Id: " + data.data.id)
return data.data.id
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment