Skip to content

Commit 0983606

Browse files
committed
fix tf lint errors
1 parent ab0047b commit 0983606

File tree

3 files changed

+44
-42
lines changed

3 files changed

+44
-42
lines changed

docs/opentofu-remote-state.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ per-checkout configuration is required.
125125
```shell
126126
openstack ec2 credentials create
127127
```
128-
128+
129129
and make a note of the `access` field returned.
130130

131131
3. Create the backend file:
@@ -157,7 +157,7 @@ per-checkout configuration is required.
157157
7. With the environment activated, initialise OpenTofu.
158158

159159
If no local state exists run:
160-
160+
161161
```shell
162162
cd environments/$ENV/tofu/
163163
tofu init
@@ -171,7 +171,7 @@ per-checkout configuration is required.
171171
9. Once it works, commit `environments/$ENV/tofu/s3.tf` and `environments/$ENV/activate`.
172172

173173
OpenTofu is now configured to use the cloud's S3-compatible storage to store
174-
state for this environment.
174+
state for this environment.
175175
176176
Repeat for each environment needing remote state.
177177
Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,42 @@
11
variable "gitlab_username" {
2-
type = string
3-
description = <<-EOF
2+
type = string
3+
description = <<-EOF
44
Username of actual GitLab user, for personal access token only.
55
Default uses bot account name, for project access token.
66
EOF
7-
default = null
7+
default = null
88
}
99

1010
variable "gitlab_access_token" {
11-
type = string
12-
description = <<-EOF
11+
type = string
12+
description = <<-EOF
1313
GitLab Project or Personal access token.
1414
Must have Maintainer role (for Project token) and API scope
1515
EOF
1616
}
1717

1818
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
2222
}
2323

2424
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}"
2828
}
2929

30+
# tflint-ignore: terraform_required_version
3031
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+
}
4142
}
Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
11
variable "s3_backend_endpoint" {
2-
type = string
3-
description = "radosgw address without protocol or path e.g. leafcloud.store"
4-
#default = # add here
2+
type = string
3+
description = "radosgw address without protocol or path e.g. leafcloud.store"
4+
#default = # add here
55
}
66

7+
# tflint-ignore: terraform_required_version
78
terraform {
8-
backend "s3" {
9-
endpoint = var.s3_backend_endpoint
10-
bucket = "${var.cluster_name}-${basename(var.environment_root)}-tfstate"
11-
key = "environment.tfstate"
12-
13-
# Reginon is required but not used in radosgw:
14-
region = "dummy"
15-
skip_region_validation = true
9+
backend "s3" {
10+
endpoint = var.s3_backend_endpoint
11+
bucket = "${var.cluster_name}-${basename(var.environment_root)}-tfstate"
12+
key = "environment.tfstate"
1613

17-
# Normally STS is not configured in radosgw:
18-
skip_credentials_validation = true
19-
20-
# Enable path-style S3 URLs (https://<HOST>/<BUCKET> instead of https://<BUCKET>.<HOST>)
21-
# may or may not be required depending on radosgw configuration
22-
use_path_style = true
23-
}
14+
# Reginon is required but not used in radosgw:
15+
region = "dummy"
16+
skip_region_validation = true
17+
18+
# Normally STS is not configured in radosgw:
19+
skip_credentials_validation = true
20+
21+
# Enable path-style S3 URLs (https://<HOST>/<BUCKET> instead of https://<BUCKET>.<HOST>)
22+
# may or may not be required depending on radosgw configuration
23+
use_path_style = true
24+
}
2425
}

0 commit comments

Comments
 (0)