Move terraform-state to b2

The terraform-state can be stored in backblaze b2 with some
configurations. This changes does exactly this. Note, that this requires
the special env-variables `AWS_SECRET_ACCESS_KEY` and
`AWS_ACCESS_KEY_ID` which are normally part of the AWS-setup. To be able
to use AWS and this setup in parallel I use dotenv to maintain the
variables in the special file `.envrc`.

Reference: https://andrzejgor.ski/posts/backblaze_b2_tf_state
Reference: https://www.reddit.com/r/selfhosted/comments/1iv1qir
Reference: https://direnv.net/
This commit is contained in:
2025-09-29 03:27:20 +02:00
parent 18a5d1eae2
commit 9d32790c99
2 changed files with 15 additions and 0 deletions

1
.gitignore vendored
View File

@@ -3,6 +3,7 @@ inventory.*
README.* README.*
!README.adoc !README.adoc
password.txt password.txt
.envrc
# Created by https://www.toptal.com/developers/gitignore/api/vim,ansible,jetbrains,terraform # Created by https://www.toptal.com/developers/gitignore/api/vim,ansible,jetbrains,terraform
# Edit at https://www.toptal.com/developers/gitignore?templates=vim,ansible,jetbrains,terraform # Edit at https://www.toptal.com/developers/gitignore?templates=vim,ansible,jetbrains,terraform

View File

@@ -1,4 +1,18 @@
terraform { terraform {
backend "s3" {
bucket = "nemoinho-tfstate"
key = "hetzner-infra/terraform.tfstate"
region = "eu-central-003"
endpoints = {
s3 = "https://s3.eu-central-003.backblazeb2.com"
}
skip_credentials_validation = true
skip_region_validation = true
skip_metadata_api_check = true
skip_requesting_account_id = true
skip_s3_checksum = true
}
required_providers { required_providers {
hetznerdns = { hetznerdns = {
source = "timohirt/hetznerdns" source = "timohirt/hetznerdns"