|
1 | 1 | variable "gitlab_username" {
|
2 |
| - type = string |
3 |
| - description = <<-EOF |
| 2 | + type = string |
| 3 | + description = <<-EOF |
4 | 4 | Username of actual GitLab user, for personal access token only.
|
5 | 5 | Default uses bot account name, for project access token.
|
6 | 6 | EOF
|
7 |
| - default = null |
| 7 | + default = null |
8 | 8 | }
|
9 | 9 |
|
10 | 10 | variable "gitlab_access_token" {
|
11 |
| - type = string |
12 |
| - description = <<-EOF |
| 11 | + type = string |
| 12 | + description = <<-EOF |
13 | 13 | GitLab Project or Personal access token.
|
14 | 14 | Must have Maintainer role (for Project token) and API scope
|
15 | 15 | EOF
|
16 | 16 | }
|
17 | 17 |
|
18 | 18 | variable "gitlab_project_id" {
|
19 |
| - type = string |
20 |
| - description = "GitLab project ID - click 3-dot menu at the top right of project page" |
21 |
| - #default = # add here |
| 19 | + type = string |
| 20 | + description = "GitLab project ID - click 3-dot menu at the top right of project page" |
| 21 | + #default = # add here |
22 | 22 | }
|
23 | 23 |
|
24 | 24 | locals {
|
25 |
| - gitlab_username = coalesce(var.gitlab_username, "project_${var.gitlab_project_id}_bot") |
26 |
| - gitlab_state_name = basename(var.environment_root) |
27 |
| - gitlab_state_address = "https://gitlab.com/api/v4/projects/${var.gitlab_project_id}/terraform/state/${local.gitlab_state_name}" |
| 25 | + gitlab_username = coalesce(var.gitlab_username, "project_${var.gitlab_project_id}_bot") |
| 26 | + gitlab_state_name = basename(var.environment_root) |
| 27 | + gitlab_state_address = "https://gitlab.com/api/v4/projects/${var.gitlab_project_id}/terraform/state/${local.gitlab_state_name}" |
28 | 28 | }
|
29 | 29 |
|
| 30 | +# tflint-ignore: terraform_required_version |
30 | 31 | terraform {
|
31 |
| - backend "http" { |
32 |
| - address = local.gitlab_state_address |
33 |
| - lock_address = "${local.gitlab_state_address}/lock" |
34 |
| - unlock_address = "${local.gitlab_state_address}/lock" |
35 |
| - username = local.gitlab_username |
36 |
| - password = var.gitlab_access_token |
37 |
| - lock_method = "POST" |
38 |
| - unlock_method = "DELETE" |
39 |
| - retry_wait_min = 5 |
40 |
| - } |
| 32 | + backend "http" { |
| 33 | + address = local.gitlab_state_address |
| 34 | + lock_address = "${local.gitlab_state_address}/lock" |
| 35 | + unlock_address = "${local.gitlab_state_address}/lock" |
| 36 | + username = local.gitlab_username |
| 37 | + password = var.gitlab_access_token |
| 38 | + lock_method = "POST" |
| 39 | + unlock_method = "DELETE" |
| 40 | + retry_wait_min = 5 |
| 41 | + } |
41 | 42 | }
|
0 commit comments