.gitlab-ci.yml 895 B
image: busybox:latest
variables:
TF_ROOT: ${CI_PROJECT_DIR}/manifests/elastic
TF_ADDRESS: ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/terraform/state/manifests/elastic
cache:
key: manifests-elastic
paths:
- ${TF_ROOT}/.terraform
# docs: https://docs.gitlab.com/ee/user/infrastructure/iac/terraform_state.html#get-started-using-gitlab-ci
elastic:
stage: deploy
tags:
- docker
image:
name: registry.gitlab.com/gitlab-org/terraform-images/stable:latest
entrypoint: [""]
variables:
TF_ROOT: $TF_ROOT
TF_ADDRESS: $TF_ADDRESS
TF_VAR_ec_apikey: $EC_API_KEY
script:
- cd ${TF_ROOT}
- terraform init
- terraform validate
- terraform fmt -check
- terraform plan
- terraform apply -auto-approve
gcloud:
stage: deploy
tags:
- docker
image:
name: google/cloud-sdk:slim
entrypoint: [""]
script:
- gcloud version