Skip to content

Instantly share code, notes, and snippets.

@KyMidd
Created January 13, 2020 04:57
Show Gist options
  • Select an option

  • Save KyMidd/abf127de5f4147d8421b372ef6f39378 to your computer and use it in GitHub Desktop.

Select an option

Save KyMidd/abf127de5f4147d8421b372ef6f39378 to your computer and use it in GitHub Desktop.
# Terraform Plan and Apply
# Plan only on pull requests, Apply on merged code
jobs:
include:
- stage: terraform plan
# Only run terraform validate and plan state if within a pull request
if: type IN (pull_request)
script:
- echo "Executing Terraform Plan on pull request code"
- terraform init $tf_init_cli_options
- terraform validate $tf_validation_cli_options
- terraform plan $tf_plan_cli_options
- stage: terraform apply
# Only run terraform apply stage if outside of a pull request
if: type IN (push) and branch = master
script:
- echo "Executing Terraform Apply on merged code"
- terraform init $tf_init_cli_options
- terraform apply $tf_apply_cli_options
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment