tofu: rename from terraform, state in its own bucket, Loki buckets
All checks were successful
nixos / nixos (push) Successful in 34s

The infrastructure is applied with OpenTofu; name it so. terraform/
becomes tofu/, the files end in .tofu (OpenTofu 1.8+ prefers them), the
local variables file is secrets.auto.tfvars, and both servers carry
managed_by=opentofu (an in-place label change).

The state moved to new buckets asxpio-tofu-main/-repl, key
tofu/state/tofu.tfstate, with `tofu init -migrate-state`; a plan against
it shows no changes. The old asxpio-terraform-* buckets stay, renamed
in the config with moved blocks, until the new state has been used for
a while.

asxpio-loki-main, created by hand, is adopted with an import block, and
a new asxpio-loki-repl in fsn1 receives it in the daily replica, which
now also copies the new state bucket instead of the old one.

What keeps the Terraform name is OpenTofu's own: the `terraform {}`
block and .terraform.lock.hcl.

Assisted-by: Claude:opus-5-5
This commit is contained in:
Sergei Poljanski 2026-11-17 09:42:53 +04:00
commit 796331815d
Signed by: asxpi
GPG key ID: 4F8851660FA4121B

55
tofu/providers.tofu Normal file
View file

@ -0,0 +1,55 @@
# Run with OpenTofu (`tofu`, in the dev shell of ../nixos).
terraform {
required_version = ">= 1.8.0"
# State in Object Storage (bucket in s3.tofu). In a new project the
# bucket does not exist yet: see README.md, Setup.
backend "s3" {
bucket = "asxpio-tofu-main"
key = "tofu/state/tofu.tfstate"
region = "hel1"
endpoint = "https://hel1.your-objectstorage.com"
skip_credentials_validation = true
skip_metadata_api_check = true
skip_region_validation = true
skip_requesting_account_id = true
use_path_style = true
}
required_providers {
hcloud = {
source = "hetznercloud/hcloud"
# 1.54 no longer reads a server's location from the Hetzner API and
# plans to replace every server because of it. Do not go below 1.70.
version = "~> 1.70"
}
minio = {
source = "aminueza/minio"
version = "~> 3.11"
}
}
}
provider "hcloud" {
token = var.hcloud_token
}
# MinIO provider for Helsinki (hel1) region
provider "minio" {
alias = "hel1"
minio_server = var.s3_endpoint_hel1
minio_user = var.s3_access_key
minio_password = var.s3_secret_key
minio_region = "hel1"
minio_ssl = true
}
# MinIO provider for Falkenstein (fsn1) region
provider "minio" {
alias = "fsn1"
minio_server = var.s3_endpoint_fsn1
minio_user = var.s3_access_key
minio_password = var.s3_secret_key
minio_region = "fsn1"
minio_ssl = true
}