feat: store Terraform state in Backblaze B2
Some checks failed
Terraform Plan / Terraform Plan (push) Failing after 9s
Some checks failed
Terraform Plan / Terraform Plan (push) Failing after 9s
Configure an s3 backend and initialize Terraform in CI with backend config from Gitea secrets so state persists across runs and apply operations stay consistent.
This commit is contained in:
@@ -22,6 +22,19 @@ jobs:
|
||||
cat > secrets.auto.tfvars << EOF
|
||||
pm_api_token_secret = "${{ secrets.PM_API_TOKEN_SECRET }}"
|
||||
EOF
|
||||
cat > backend.hcl << EOF
|
||||
bucket = "${{ secrets.B2_TF_BUCKET }}"
|
||||
key = "terraform.tfstate"
|
||||
region = "us-east-005"
|
||||
endpoint = "${{ secrets.B2_TF_ENDPOINT }}"
|
||||
access_key = "${{ secrets.B2_KEY_ID }}"
|
||||
secret_key = "${{ secrets.B2_APPLICATION_KEY }}"
|
||||
skip_credentials_validation = true
|
||||
skip_metadata_api_check = true
|
||||
skip_region_validation = true
|
||||
skip_requesting_account_id = true
|
||||
force_path_style = true
|
||||
EOF
|
||||
echo "Created secrets.auto.tfvars:"
|
||||
cat secrets.auto.tfvars | sed 's/=.*/=***/'
|
||||
echo "Using token ID from terraform.tfvars:"
|
||||
@@ -34,7 +47,7 @@ jobs:
|
||||
|
||||
- name: Terraform Init
|
||||
working-directory: terraform
|
||||
run: terraform init
|
||||
run: terraform init -reconfigure -backend-config=backend.hcl
|
||||
|
||||
- name: Terraform Format Check
|
||||
working-directory: terraform
|
||||
|
||||
Reference in New Issue
Block a user