Sync terraform state to restic

This allows it to be backed up easily
This commit is contained in:
Jake Howard
2024-01-09 19:46:40 +00:00
parent 4a69df1d6c
commit 06b9197c5b
8 changed files with 108 additions and 3 deletions

View File

@ -1,3 +0,0 @@
resource "aws_iam_user" "minio" {
name = "minio"
}

28
terraform/rclone.tf Normal file
View File

@ -0,0 +1,28 @@
resource "aws_iam_user" "rclone" {
name = "rclone"
}
resource "aws_iam_user_policy" "read-terraform-state" {
name = "read-terraform-state"
user = aws_iam_user.rclone.name
policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ReadTerraformState",
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:ListBucket"
],
"Resource": [
"${aws_s3_bucket.tfstate.arn}/*",
"${aws_s3_bucket.tfstate.arn}"
]
}
]
}
EOF
}

View File

@ -2,6 +2,10 @@ resource "aws_iam_user" "terraform" {
name = "terraform"
}
resource "aws_iam_user" "minio" {
name = "minio"
}
resource "aws_s3_bucket" "tfstate" {
bucket = "0rng-terraform"
}