Skip to content

Commit

Permalink
Fix to pass access token
Browse files Browse the repository at this point in the history
  • Loading branch information
MikuroXina committed Sep 26, 2023
1 parent dc746be commit b857d76
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/staging-apply.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ jobs:
with:
workload_identity_provider: "projects/1065320521129/locations/global/workloadIdentityPools/ci-pool/providers/ci-provider"
service_account: "staging-deploy-from-github-act@pulsate-staging-400117.iam.gserviceaccount.com"
token_format: "access_token"

- name: Upload Configuration
uses: "hashicorp/tfc-workflows-github/actions/upload-configuration@v1.0.4"
Expand All @@ -90,6 +91,8 @@ jobs:
with:
workspace: ${{ env.TF_WORKSPACE }}
configuration_version: ${{ steps.apply-upload.outputs.configuration_version_id }}
env:
TF_VAR_access_token: ${{ steps.auth.outputs.access_token }}
- name: Apply
uses: "hashicorp/tfc-workflows-github/actions/apply-run@v1.0.4"
if: fromJSON(steps.apply-run.outputs.payload).data.attributes.actions.IsConfirmable
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/staging-plan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
with:
workload_identity_provider: "projects/1065320521129/locations/global/workloadIdentityPools/ci-pool/providers/ci-provider"
service_account: "staging-deploy-from-github-act@pulsate-staging-400117.iam.gserviceaccount.com"
token_format: "access_token"

- name: Upload Configuration
uses: "hashicorp/tfc-workflows-github/actions/upload-configuration@v1.0.4"
Expand All @@ -43,6 +44,8 @@ jobs:
workspace: ${{ env.TF_WORKSPACE }}
configuration_version: ${{ steps.plan-upload.outputs.configuration_version_id }}
plan_only: true
env:
TF_VAR_access_token: ${{ steps.auth.outputs.access_token }}
- name: Get Plan Output
uses: "hashicorp/tfc-workflows-github/actions/plan-output@v1.0.0"
id: plan-output
Expand Down
5 changes: 3 additions & 2 deletions staging/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ terraform {
}

provider "google" {
project = var.project
region = var.location
project = var.project
region = var.location
access_token = var.access_token
}

resource "google_project_service" "default" {
Expand Down
6 changes: 6 additions & 0 deletions staging/variables.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
variable "access_token" {
description = "An acceess token for login to GCP"
type = string
default = null
}

variable "project" {
description = "A name of a GCP project"
type = string
Expand Down

0 comments on commit b857d76

Please sign in to comment.