Skip to content

Instantly share code, notes, and snippets.

@kevincloud
Last active July 20, 2020 03:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kevincloud/9ca34eb606068ea62e0c5419f925068d to your computer and use it in GitHub Desktop.
Save kevincloud/9ca34eb606068ea62e0c5419f925068d to your computer and use it in GitHub Desktop.
def overridePolicy(policyid) {
def response = httpRequest(
customHeaders: [
[ name: "Authorization", value: "Bearer " + env.BEARER_TOKEN ],
[ name: "Content-Type", value: "application/vnd.api+json" ]
],
httpMode: 'POST',
url: "https://app.terraform.io/api/v2/policy-checks/${policyid}/actions/override"
)
def data = new JsonSlurper().parseText(response.content)
if (data.data.attributes.status != "overridden") {
return false
}
else {
return true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment