Skip to content

Commit 38da823

Browse files
committed
feat: add backblaze backups bucket
1 parent 6e6797f commit 38da823

7 files changed

Lines changed: 54 additions & 0 deletions

File tree

.github/workflows/tf-plan-apply.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ jobs:
2828
envrc_content: |
2929
export TF_VAR_proxmox_endpoint="${{ secrets.TF_VAR_proxmox_endpoint }}"
3030
export TF_VAR_proxmox_api_token="${{ secrets.TF_VAR_proxmox_api_token }}"
31+
export TF_VAR_b2_application_key_id="${{ secrets.TF_VAR_b2_application_key_id }}"
32+
export TF_VAR_b2_application_key="${{ secrets.TF_VAR_b2_application_key }}"
3133
aws_role_arn: ${{ secrets.AWS_ROLE_ARN }}
3234

3335
plan_apply:
@@ -40,6 +42,8 @@ jobs:
4042
envrc_content: |
4143
export TF_VAR_proxmox_endpoint="${{ secrets.TF_VAR_proxmox_endpoint }}"
4244
export TF_VAR_proxmox_api_token="${{ secrets.TF_VAR_proxmox_api_token }}"
45+
export TF_VAR_b2_application_key_id="${{ secrets.TF_VAR_b2_application_key_id }}"
46+
export TF_VAR_b2_application_key="${{ secrets.TF_VAR_b2_application_key }}"
4347
headscale_auth_key: ${{ secrets.HEADSCALE_AUTH_KEY }}
4448
aws_role_arn: ${{ secrets.AWS_ROLE_ARN }}
4549
output_encryption_key: ${{ secrets.OUTPUT_ENCRYPTION_KEY }}

.github/workflows/tf-plan.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ jobs:
2020
envrc_content: |
2121
export TF_VAR_proxmox_endpoint="${{ secrets.TF_VAR_proxmox_endpoint }}"
2222
export TF_VAR_proxmox_api_token="${{ secrets.TF_VAR_proxmox_api_token }}"
23+
export TF_VAR_b2_application_key_id="${{ secrets.TF_VAR_b2_application_key_id }}"
24+
export TF_VAR_b2_application_key="${{ secrets.TF_VAR_b2_application_key }}"
2325
aws_role_arn: ${{ secrets.AWS_ROLE_ARN }}
2426

2527
plan:
@@ -32,6 +34,8 @@ jobs:
3234
envrc_content: |
3335
export TF_VAR_proxmox_endpoint="${{ secrets.TF_VAR_proxmox_endpoint }}"
3436
export TF_VAR_proxmox_api_token="${{ secrets.TF_VAR_proxmox_api_token }}"
37+
export TF_VAR_b2_application_key_id="${{ secrets.TF_VAR_b2_application_key_id }}"
38+
export TF_VAR_b2_application_key="${{ secrets.TF_VAR_b2_application_key }}"
3539
headscale_auth_key: ${{ secrets.HEADSCALE_AUTH_KEY }}
3640
aws_role_arn: ${{ secrets.AWS_ROLE_ARN }}
3741
output_encryption_key: ${{ secrets.OUTPUT_ENCRYPTION_KEY }}

src/tf/.terraform.lock.hcl

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/tf/backup.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
locals {
2+
backup_bucket_name = "sgfdevs-vm-workloads-backups"
3+
}
4+
5+
resource "b2_bucket" "backups" {
6+
bucket_name = local.backup_bucket_name
7+
bucket_type = "allPrivate"
8+
}

src/tf/providers.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,8 @@ provider "proxmox" {
77
provider "aws" {
88
region = var.aws_region
99
}
10+
11+
provider "b2" {
12+
application_key_id = var.b2_application_key_id
13+
application_key = var.b2_application_key
14+
}

src/tf/variables.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,15 @@ variable "aws_region" {
1414
type = string
1515
default = "us-east-2"
1616
}
17+
18+
variable "b2_application_key_id" {
19+
description = "Backblaze B2 application key ID for Terraform bucket management"
20+
type = string
21+
sensitive = true
22+
}
23+
24+
variable "b2_application_key" {
25+
description = "Backblaze B2 application key for Terraform bucket management"
26+
type = string
27+
sensitive = true
28+
}

src/tf/versions.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ terraform {
1010
source = "hashicorp/aws"
1111
version = "~> 6.33"
1212
}
13+
b2 = {
14+
source = "Backblaze/b2"
15+
version = "~> 0.12"
16+
}
1317
proxmox = {
1418
source = "bpg/proxmox"
1519
version = "~> 0.97"

0 commit comments

Comments
 (0)