Check Makefile to understand module precedence
-
Clone this repo localy
-
Pull submodules
git submodule update --init --recursive-
Customise locals in main.tf according to your needs
-
Add the script directory of this repo to your PATH
-
export GITLAB_TOKEN and GITLAB_USERNAME in your env
-
export the SA Google application credentials to your env. generate it from the /internal/dsi-devops-engineers/infrastructure-terraform-gcp-org-of2m.fr repo.
export GOOGLE_APPLICATION_CREDENTIALS=/home/olivier/git/gitlab-additi/internal/dsi-devops-engineers/infrastructure-terraform-gcp-org-of2m.fr/credentials/terraform-sa.json
-
Load external scripts to your
$PATHclone [email protected]:additi/internal/dsi-devops-engineers/tools/infrastructure-configuration-docker-gitlabci-terraform.git and add scripts directory to your
$PATH -
init terraform using http backend method :
terraform init \
-reconfigure \
-backend-config="address=https://gitlab.com/api/v4/projects/[PROJECT_ID]/terraform/state/tfstate" \
-backend-config="lock_address=https://gitlab.com/api/v4/projects/[PROJECT_ID]/terraform/state/tfstate/lock" \
-backend-config="unlock_address=https://gitlab.com/api/v4/projects/[PROJECT_ID]/terraform/state/tfstate/lock" \
-backend-config="username=${GITLAB_USERNAME}" \
-backend-config="password=${GITLAB_TOKEN}" \
-backend-config="lock_method=POST" \
-backend-config="unlock_method=DELETE" \
-backend-config="retry_wait_min=5"
Or use the gitlab_terraform_init from the devops cli tool provided on github