Support Gitlab managed Terraform backend
Closes: #171 (closed) Related: #240 (closed)
Adds support for multiple backend types, starting with gcs and http.
To do
-
Solidify approach after feedback -
Update documentation to match approach
References
Testing
http backend (GitLab)
# ./secrets/gitlab-cluster-rc.sh
# Terraform configs for resources
GCLOUD_ZONE="<zone>"
TERRAFORM_PREFIX="<prefix>"
SSH_USER="ansible"
VAULT_PASSWORD_FILE="vault-password-file"
GOOGLE_JSON_FILE="google-credentials.json"
# Terraform backend configs for gitlab
BACKEND=gitlab
GITLAB_API_USERNAME=<username> # your GitLab username, or username of a bot
GITLAB_API_TOKEN=<apiToken> # API token generated under Settings with 'api' access
GITLAB_API_V4_URL=https://gitlab.com/api/v4 # this is the value if using .com
GITLAB_PROJECT_ID=<project ID> # available on project summary page
GITLAB_PROJECT_NAME=<project name> # the project name - can be an existing or blank/new project for testing
./provision-cluster successfully created backend in GitLab project and resources in GCS.
To see backend state JSON: https://gitlab.com/api/v4/projects/<project ID>/terraform/state/<project name>
GCS backend
# ./secrets/gitlab-cluster-rc.sh
# Terraform configs for resources
GCLOUD_ZONE="<zone>"
TERRAFORM_PREFIX="<prefix>"
SSH_USER="ansible"
VAULT_PASSWORD_FILE="vault-password-file"
GOOGLE_JSON_FILE="google-credentials.json"
# Terraform backend configs for GCS
BACKEND=gcs
STATE_GCS_BUCKET="gcsBucketName"
GCS_PREFIX="tf"
./provision-cluster successfully created backend and resources in GCS.
Edited by Robert Marshall