...
Code Block | ||
---|---|---|
| ||
pipelines: tags: '*': - step: script: - apt-get update - apt-get install -y jq - export FILEPATH="$BITBUCKET_CLONE_DIR/my_terraform_file.tf" - if [ -f "$FILEPATH" ]; then echo "File exists" ; else exit 1; fi - | export TERRAFORM_DATA_THEOREM_RESPONSE=$(curl -X POST 'https://api.securetheorem.com/apis/devops/v1/iac_scans' \ --header 'Content-Type: multipart/form-data' \ --header '"Authorization: APIKey $TERRAFORM_API_KEY'" \ --form 'file=@"'"$FILEPATH"'"' \ --form 'scan_type="TERRAFORM"') export TERRAFORM_ISSUES_COUNT=$(echo $DATATHEOREM_API_RESULT_API_KEY | tr '\r\n' ' ' | jq -r ".issues_count") export MARKDOWN_RESULT=$(echo $TERRAFORM_DATA_THEOREM_RESPONSE | tr '\r\n' ' ' | jq -r ".result_as_markdown") if [ $TERRAFORM_ISSUES_COUNT == 0 ]; then echo "Deploying file: terraform_example_configuration" else echo "Terraform file contains $TERRAFORM_ISSUES_COUNT issues, abort deployment..." echo "Terraform file issues report: $MARKDOWN_RESULT" exit 1 fi |
...