.gitlab-ci.yml 882 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_VAR_ec_apikey: $EC_API_KEY
script: |-
printenv
echo $TF_ADDRESS
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: |-
printenv
gcloud version