Ability to use pull command
In my pipeline I use terraform state pull
for pulling and parsing state file.
Because of state pull
command is missing in gitlab-terraform
I'm forced to use "raw" terraform:
post_deploy:
variables:
TF_HTTP_ADDRESS: ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/terraform/state/${TF_PROJECT}
TF_HTTP_LOCK_ADDRESS: ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/terraform/state/${TF_PROJECT}/lock
TF_HTTP_LOCK_METHOD: "POST"
TF_HTTP_UNLOCK_ADDRESS: ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/terraform/state/${TF_PROJECT}/lock
TF_HTTP_UNLOCK_METHOD: "DELETE"
TF_HTTP_USERNAME: "gitlab-ci-token"
TF_HTTP_PASSWORD: "${CI_JOB_TOKEN}"
TF_HTTP_RETRY_WAIT_MIN: 5
TF_IN_AUTOMATION: "true"
script:
- terraform init
- terraform state pull > state.json
- my_parsing_script.sh state.json
It would be more convenient if the command pull
was supported in gitlab-terraform
script:
post_deploy:
script:
- gitlab-terraform state pull > state.json
Edited by Alexander Alexandrov