Last active
June 11, 2019 08:06
-
-
Save dehio3/eaff6418ce7dfef19d35e2e34d747eb3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 2.1 | |
executors: | |
default: | |
working_directory: ~/aws-terraform | |
docker: | |
- image: hashicorp/terraform:light | |
commands: | |
install_tfnotify: | |
steps: | |
- run: | |
name: install tfnotify | |
command: | | |
apk --update add go libc-dev | |
go get -u -v github.com/mercari/tfnotify | |
jobs: | |
plan: | |
executor: | |
name: default | |
steps: | |
- checkout | |
- install_tfnotify | |
- run: | |
name: Init terraform | |
command: terraform init | |
- run: | |
name: Validate terraform | |
command: terraform validate | |
- run: | |
name: Plan terraform | |
command: terraform plan | /root/go/bin/tfnotify plan | |
deploy: | |
executor: | |
name: default | |
steps: | |
- checkout | |
- install_tfnotify | |
- run: | |
name: Init terraform | |
command: terraform init | |
- run: | |
name: Apply terraform | |
command: terraform apply -auto-approve | /root/go/bin/tfnotify apply | |
destroy: | |
executor: | |
name: default | |
steps: | |
- checkout | |
- install_tfnotify | |
- run: | |
name: Init terraform | |
command: terraform init | |
- run: | |
name: destroy terraform | |
command: terraform destroy -auto-approve | |
workflows: | |
version: 2 | |
plan-and-deploy: | |
jobs: | |
- plan | |
- hold: | |
type: approval | |
requires: | |
- plan | |
filters: | |
branches: | |
only: master | |
- deploy: | |
requires: | |
- plan | |
filters: | |
branches: | |
only: master | |
- destroy: | |
requires: | |
- deploy | |
filters: | |
branches: | |
only: master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment