Skip to content

Commit 7866979

Browse files
committed
make s3 buckets clearer
1 parent 3648114 commit 7866979

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

docs/opentofu-remote-state.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,15 @@ per-checkout configuration is required.
109109

110110
### Initial setup
111111

112-
1. Create an S3 bucket matching the current environment name:
112+
1. Create an S3 bucket with a name `${cluster_name}-${environment_name}-tfstate`
113+
where:
114+
- `CLUSTER_NAME` is defined in `environments/$ENV/tofu/main.tf`
115+
- `$ENVIRONMENT_NAME` is the name of the environment directory
116+
117+
e.g.
113118

114119
```shell
115-
openstack container create $(basename $APPLIANCES_ENVIRONMENT_ROOT)
120+
openstack container create research-staging-tfstate
116121
```
117122

118123
2. Create `ec2` credentials:

environments/site/tofu/example-backends/s3.tf

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@ variable "s3_backend_endpoint" {
44
default = # Set this here
55
}
66

7-
variable "s3"
8-
97
terraform {
108
backend "s3" {
119
endpoint = var.s3_backend_endpoint
12-
bucket = basename(var.environment_root)
10+
bucket = "${var.cluster_name}-${basename(var.environment_root)}-tfstate"
1311
key = "environment.tfstate"
1412

1513
# Reginon is required but not used in radosgw:

0 commit comments

Comments
 (0)