From a72e580ae6d65ca6c91003b4497d1f7eab27b1ca Mon Sep 17 00:00:00 2001 From: Haitao Pan Date: Fri, 26 Jun 2026 17:47:49 +0800 Subject: [PATCH] fix(ci): default tf state region to us-east-1 --- .github/workflows/deploy-ai-workspace-iac.yaml | 2 +- docs/operations/iac-prerequisites.md | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy-ai-workspace-iac.yaml b/.github/workflows/deploy-ai-workspace-iac.yaml index bce1fc9..6851cfe 100644 --- a/.github/workflows/deploy-ai-workspace-iac.yaml +++ b/.github/workflows/deploy-ai-workspace-iac.yaml @@ -224,7 +224,7 @@ jobs: terraform init -input=false \ -backend-config="bucket=${TF_STATE_BUCKET}" \ -backend-config="key=ai-workspace/terraform.tfstate" \ - -backend-config="region=${TF_STATE_REGION:-auto}" + -backend-config="region=${TF_STATE_REGION:-us-east-1}" - name: Terraform ${{ github.event.inputs.terraform_action || 'apply' }} working-directory: ${{ env.ENV_DIR }} diff --git a/docs/operations/iac-prerequisites.md b/docs/operations/iac-prerequisites.md index f942294..c91734c 100644 --- a/docs/operations/iac-prerequisites.md +++ b/docs/operations/iac-prerequisites.md @@ -107,6 +107,10 @@ vault kv patch kv/CICD \ ``` - 填入 `TF_STATE_ENDPOINT=https://ewr1.vultrobjects.com`,`TF_STATE_REGION=us-east-1` +**AWS S3** +- 如果后端是 AWS S3 标准 bucket,`TF_STATE_ENDPOINT` 通常直接填 S3 API endpoint,例如 `https://s3.us-east-1.amazonaws.com` +- `TF_STATE_REGION` 需要与 bucket 所在区域一致;对 `ai-workspace-tfstate` 这类 us-east-1 bucket,填 `us-east-1` + **Cloudflare R2**(已在用 CF,无出口流量费): - 控制台 → R2 → 建 bucket → Manage API Tokens → 建读写 token - `TF_STATE_ENDPOINT=https://.r2.cloudflarestorage.com`