Created
September 19, 2019 12:33
-
-
Save pascalwhoop/07c2eb3bb883b5b69cbf2eb4c65474ed 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
image: | |
name: hashicorp/terraform:0.12.8 | |
entrypoint: | |
- '/usr/bin/env' | |
- 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' | |
before_script: | |
## Run ssh-agent (inside the build environment) | |
- eval $(ssh-agent -s) | |
- echo "$SSH_PRIVATE_KEY" | ssh-add - | |
- mkdir -p ~/.ssh | |
- ssh-keyscan github.com >> ~/.ssh/known_hosts | |
- cd env/$CI_COMMIT_REF_NAME | |
- terraform init | |
stages: | |
- validate | |
- plan | |
- apply | |
validate: | |
stage: validate | |
script: | |
- terraform validate | |
plan: | |
stage: plan | |
script: | |
- terraform plan -out "planfile" | |
dependencies: | |
- validate | |
artifacts: | |
paths: | |
- planfile | |
apply: | |
stage: apply | |
script: | |
- terraform apply -input=false "planfile" | |
dependencies: | |
- plan | |
when: manual |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment