terraform: store state on S3

This commit is contained in:
Pierre Bourdon 2024-07-07 18:22:41 +02:00
parent 0c68a23275
commit 30859b2872
Signed by untrusted user: delroth
GPG key ID: 6FB80DCD84DA0F1C
2 changed files with 22 additions and 0 deletions

View file

@ -1,5 +1,6 @@
{ {
imports = [ imports = [
./hydra.nix ./hydra.nix
./state.nix
]; ];
} }

21
terraform/state.nix Normal file
View file

@ -0,0 +1,21 @@
{
# We use terraform.backend.s3 directly instead of the type-checked Terranix
# backend.s3 options. The latter does not support setting arbitrary s3
# endpoints.
#
# Note: currently requires the user to provide AWS_ACCESS_KEY_ID as well as
# AWS_SECRET_ACCESS_KEY in their environment variables.
terraform.backend.s3 = {
endpoints.s3 = "s3.delroth.net";
region = "garage";
bucket = "bagel-terraform-state";
key = "state";
# It's just a dump Garage server, don't try to be smart.
skip_credentials_validation = true;
skip_region_validation = true;
skip_requesting_account_id = true;
skip_metadata_api_check = true;
};
}