SHARE
TWEET

Untitled

a guest May 25th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. version: 2.1
  2.  
  3. executors:
  4.   default:
  5.     working_directory: ~/aws-terraform
  6.     docker:
  7.       - image: hashicorp/terraform:light
  8.  
  9. commands:
  10.   install_tfnotify:
  11.     steps:
  12.       - run:
  13.           name: install tfnotify
  14.           command: |
  15.             apk --update add go libc-dev
  16.             go get -u -v github.com/mercari/tfnotify
  17.  
  18. jobs:
  19.   plan:
  20.     executor:
  21.       name: default
  22.     steps:
  23.       - checkout
  24.       - install_tfnotify
  25.       - run:
  26.           name: Init terraform
  27.           command: terraform init
  28.       - run:
  29.           name: Validate terraform
  30.           command: terraform validate
  31.       - run:
  32.           name: Plan terraform
  33.           command: terraform plan | /root/go/bin/tfnotify plan
  34.  
  35.   deploy:
  36.     executor:
  37.       name: default
  38.     steps:
  39.       - checkout
  40.       - install_tfnotify
  41.       - run:
  42.           name: Init terraform
  43.           command: terraform init
  44.       - run:
  45.           name: Apply terraform
  46.           command: terraform apply -auto-approve | /root/go/bin/tfnotify apply
  47.  
  48.   destroy:
  49.     executor:
  50.       name: default
  51.     steps:
  52.       - checkout
  53.       - install_tfnotify
  54.       - run:
  55.           name: Init terraform
  56.           command: terraform init
  57.       - run:
  58.           name: destroy terraform
  59.           command: terraform destroy -auto-approve
  60.  
  61. workflows:
  62.   version: 2
  63.   plan-and-deploy:
  64.     jobs:
  65.       - plan
  66.       - hold:
  67.           type: approval
  68.           requires:
  69.             - plan
  70.           filters:
  71.             branches:
  72.               only: master
  73.       - deploy:
  74.           requires:
  75.             - plan
  76.           filters:
  77.             branches:
  78.               only: master
  79.       - destroy:
  80.           requires:
  81.             - deploy
  82.           filters:
  83.             branches:
  84.               only: master
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top