Created
May 4, 2020 23:44
-
-
Save brunodasilvalenga/818335b1b0017fad3a8dff146dd66272 to your computer and use it in GitHub Desktop.
This file contains hidden or 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: dnxsolutions/musketeers:1.1.0 | |
services: | |
- docker:18.03.1-ce-dind # needs to match gitlab runner version | |
variables: | |
DOCKER_HOST: "tcp://docker:2375" | |
stages: | |
- plan-developer | |
- apply-developer | |
- destroy-developer | |
- plan-dev | |
- apply-dev | |
- plan-prod | |
- apply-prod | |
"terraform plan developer": | |
stage: plan-developer | |
tags: [example_runner, docker] | |
variables: | |
AWS_ACCOUNT_ID: 000000000000 #NONPROD | |
AWS_ROLE: ci-deploy | |
WORKSPACE: nonprod-ap-southeast-2-dev-${USER_ID} | |
artifacts: | |
paths: | |
- .terraform-plan-* | |
script: | |
- terraform init | |
- terraform plan | |
only: | |
refs: | |
- web | |
variables: | |
- $USER_ID | |
"terraform apply developer": | |
stage: apply-developer | |
when: manual | |
tags: [example_runner, docker] | |
variables: | |
AWS_ACCOUNT_ID: 000000000000 #NONPROD | |
AWS_ROLE: ci-deploy | |
WORKSPACE: nonprod-ap-southeast-2-dev-${USER_ID} | |
dependencies: | |
- "terraform plan developer" | |
script: | |
- terraform init | |
- terraform apply | |
only: | |
refs: | |
- web | |
variables: | |
- $USER_ID | |
"terraform destroy developer": | |
stage: destroy-developer | |
when: manual | |
tags: [example_runner, docker] | |
variables: | |
AWS_ACCOUNT_ID: 000000000000 #NONPROD | |
AWS_ROLE: ci-deploy | |
WORKSPACE: nonprod-ap-southeast-2-dev-${DESTROY_USER_ID} | |
script: | |
- terraform init | |
- terraform destroy | |
only: | |
refs: | |
- web | |
variables: | |
- $DESTROY_USER_ID | |
"terraform plan dev": | |
stage: plan-dev | |
tags: [example_runner, docker] | |
variables: | |
AWS_ACCOUNT_ID: 000000000000 #NONPROD | |
AWS_ROLE: ci-deploy | |
WORKSPACE: nonprod-ap-southeast-2-dev | |
artifacts: | |
paths: | |
- .terraform-plan-* | |
script: | |
- terraform init | |
- terraform plan | |
except: | |
refs: | |
- web | |
variables: | |
- $USER_ID | |
"terraform apply dev": | |
stage: apply-dev | |
when: manual | |
tags: [example_runner, docker] | |
variables: | |
AWS_ACCOUNT_ID: 000000000000 #NONPROD | |
AWS_ROLE: ci-deploy | |
WORKSPACE: nonprod-ap-southeast-2-dev | |
dependencies: | |
- "terraform plan dev" | |
script: | |
- terraform init | |
- terraform apply | |
only: | |
- master | |
except: | |
refs: | |
- web | |
variables: | |
- $USER_ID | |
"terraform plan prod": | |
stage: plan-prod | |
tags: [example_runner, docker] | |
variables: | |
AWS_ACCOUNT_ID: 000000000000 #PROD | |
AWS_ROLE: ci-deploy | |
WORKSPACE: prod-ap-southeast-2-default | |
artifacts: | |
paths: | |
- .terraform-plan-* | |
script: | |
- terraform init | |
- terraform plan | |
dependencies: | |
- "terraform apply dev" | |
except: | |
refs: | |
- web | |
variables: | |
- $USER_ID | |
"terraform apply prod": | |
stage: apply-prod | |
when: manual | |
tags: [example_runner, docker] | |
variables: | |
AWS_ACCOUNT_ID: 000000000000 #PROD | |
AWS_ROLE: ci-deploy | |
WORKSPACE: prod-ap-southeast-2-default | |
dependencies: | |
- "terraform plan prod" | |
- "terraform apply dev" | |
script: | |
- terraform init | |
- terraform apply | |
only: | |
- master | |
except: | |
refs: | |
- web | |
variables: | |
- $USER_ID |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment