diff --git a/.github/workflows/actions.yaml b/.github/workflows/actions.yaml index e750d98..dc7ba58 100644 --- a/.github/workflows/actions.yaml +++ b/.github/workflows/actions.yaml @@ -85,8 +85,9 @@ jobs: --header "Content-Type: application/vnd.api+json" \ --request POST \ --data "{\"data\":{\"attributes\":{\"name\":\"${{ env.WS_NAME }}\",\"execution-mode\":\"local\"},\"type\":\"workspaces\"}}" \ - https://app.terraform.io/api/v2/organizations/kenf-hcp-org/workspaces || true + https://app.terraform.io/api/v2/organizations/${{ vars.TF_ORGANIZATION }}/workspaces || true + sed -i "s/TF_ORGANIZATION_PLACEHOLDER/${{ vars.TF_ORGANIZATION }}/g" main.tf sed -i "s/RESUME_HOSTING_WORKSPACE_PLACEHOLDER/${{ env.WS_NAME }}/g" main.tf terraform init terraform apply --auto-approve diff --git a/.github/workflows/destroy.yaml b/.github/workflows/destroy.yaml index 7d6adfa..ada2e0c 100644 --- a/.github/workflows/destroy.yaml +++ b/.github/workflows/destroy.yaml @@ -42,8 +42,9 @@ jobs: --header "Content-Type: application/vnd.api+json" \ --request POST \ --data "{\"data\":{\"attributes\":{\"name\":\"${{ env.WS_NAME }}\",\"execution-mode\":\"local\"},\"type\":\"workspaces\"}}" \ - https://app.terraform.io/api/v2/organizations/kenf-hcp-org/workspaces || true + https://app.terraform.io/api/v2/organizations/${{ vars.TF_ORGANIZATION }}/workspaces || true + sed -i "s/TF_ORGANIZATION_PLACEHOLDER/${{ vars.TF_ORGANIZATION }}/g" main.tf sed -i "s/RESUME_HOSTING_WORKSPACE_PLACEHOLDER/${{ env.WS_NAME }}/g" main.tf terraform init terraform destroy --auto-approve @@ -54,5 +55,5 @@ jobs: --header "Authorization: Bearer ${{ secrets.TF_API_TOKEN }}" \ --header "Content-Type: application/vnd.api+json" \ --request DELETE \ - "https://app.terraform.io/api/v2/organizations/kenf-hcp-org/workspaces/${{ env.WS_NAME }}" || echo "Workspace deletion failed or already deleted" + "https://app.terraform.io/api/v2/organizations/${{ vars.TF_ORGANIZATION }}/workspaces/${{ env.WS_NAME }}" || echo "Workspace deletion failed or already deleted" working-directory: ./terraform diff --git a/README.md b/README.md index d0c22a5..0c0a84e 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ Fork this repo and add the following to **Settings -> Secrets and variables -> A **Variables:** - `DOMAIN_NAME`: e.g., `resume.kenf.dev` - `PROJECT_NAME`: e.g., `resume-hosting` +- `TF_ORGANIZATION`: Your HCP Terraform Organization name. ### 3. Deploy - **Production**: Push to `main`. The system will automatically create your HCP Terraform workspace and deploy to your domain. diff --git a/terraform/main.tf b/terraform/main.tf index 5c0a838..ae80147 100644 --- a/terraform/main.tf +++ b/terraform/main.tf @@ -1,6 +1,6 @@ terraform { cloud { - organization = "kenf-hcp-org" + organization = "TF_ORGANIZATION_PLACEHOLDER" workspaces { name = "RESUME_HOSTING_WORKSPACE_PLACEHOLDER"