zivildienst/infrastructure/modules/storage/remote_state.tf

21 lines
991 B
HCL

locals {
environment = lookup(jsondecode(file("../../config.json")), "terraform_packer_environment", "")
project = lookup(jsondecode(file("../../secrets.json")), "terraform_gitlab_backend_project", "")
username = lookup(jsondecode(file("../../secrets.json")), "terraform_gitlab_backend_username", "")
password = lookup(jsondecode(file("../../secrets.json")), "terraform_gitlab_backend_password", "")
}
data "terraform_remote_state" "environment" {
backend = "http"
config = {
address="https://gitlab.com/api/v4/projects/${local.project}/terraform/state/${local.environment}-environment"
lock_address="https://gitlab.com/api/v4/projects/${local.project}/terraform/state/${local.environment}-environment/lock"
unlock_address="https://gitlab.com/api/v4/projects/${local.project}/terraform/state/${local.environment}-environment/lock"
username=local.username
password=local.password
lock_method="POST"
unlock_method="DELETE"
retry_wait_min="5"
}
}