Skip to content

Commit

Permalink
fix: personal token
Browse files Browse the repository at this point in the history
  • Loading branch information
okradze committed Jan 22, 2024
1 parent 736d2cc commit 1b92480
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 56 deletions.
60 changes: 29 additions & 31 deletions .github/workflows/tf_apply_server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,62 +4,61 @@ on:
workflow_call:
inputs:
path:
description: 'Specifies the path of the root terraform module.'
description: "Specifies the path of the root terraform module."
required: true
type: string
tf_version:
description: 'Specifies version of Terraform to use. e.g: 1.1.0 Default=latest.'
description: "Specifies version of Terraform to use. e.g: 1.1.0 Default=latest."
required: false
type: string
default: latest
gh_environment:
description: 'Specifies the GitHub deployment environment.'
description: "Specifies the GitHub deployment environment."
required: false
type: string
default: null
tf_vars_file:
description: 'Specifies the Terraform TFVARS file.'
description: "Specifies the Terraform TFVARS file."
required: true
type: string
task_container_version:
description: 'Specifies the version of the container to deploy.'
description: "Specifies the version of the container to deploy."
required: true
type: string
task_container_registry:
description: 'Task Container Registry'
required: true
type: string
description: "Task Container Registry"
required: true
type: string
task_container_name:
description: 'Task Container Name'
required: true
type: string
description: "Task Container Name"
required: true
type: string
secrets:
cli_config_credentials_token:
description: 'CLI configuration credentials token'
description: "CLI configuration credentials token"
required: true
azure_acr_username:
description: 'Azure ACR (Azure Container Registry) username'
description: "Azure ACR (Azure Container Registry) username"
required: true
azure_acr_password:
description: 'Azure ACR (Azure Container Registry) password'
description: "Azure ACR (Azure Container Registry) password"
required: true
azure_tenant_id:
description: 'Azure Tenant ID for the subscription'
description: "Azure Tenant ID for the subscription"
required: true
azure_subscription_id:
description: 'Azure subscription ID'
description: "Azure subscription ID"
required: true
azure_client_id:
description: 'Azure Client ID'
description: "Azure Client ID"
required: true
azure_client_secret:
description: 'Azure Client Secret'
description: "Azure Client Secret"
required: true
github_personal_access_token:
description: 'GitHub Personal Access Token'
description: "GitHub Personal Access Token"
required: true


jobs:
build-plan:
runs-on: ubuntu-latest
Expand All @@ -69,11 +68,11 @@ jobs:
run:
shell: bash
working-directory: ${{ inputs.path }}

steps:
- name: Checkout
uses: actions/[email protected]

- name: Download file
uses: actions/download-artifact@v2
with:
Expand All @@ -89,30 +88,29 @@ jobs:
with:
terraform_version: ${{ inputs.tf_version }}
cli_config_credentials_token: ${{ secrets.cli_config_credentials_token }}

- name: Terraform Init
env:
GITHUB_TOKEN: ${{ secrets.github_personal_access_token }}
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
TF_WORKSPACE: ${{ inputs.gh_environment }}
run: |
git config --global url."https://x-access-token:${GITHUB_TOKEN}@github.com/".insteadOf "https://github.com/"
terraform init
# - name: Terraform Workspace Creation
# run: terraform workspace new ${{ inputs.task_container_name }}-${{ inputs.gh_environment }} || true

# - name: Terraform Workspace Selection
# run: terraform workspace select ${{ inputs.task_container_name }}-${{ inputs.gh_environment }}

- name: Terraform Validate
id: validate
run: terraform validate

- name: Terraform Plan
id: plan
env:
TF_VAR_region: 'us-west-1' #replace with your variable and value
TF_VAR_region: "us-west-1" #replace with your variable and value
TF_VAR_azure_client_id: ${{ secrets.azure_client_id }}
TF_VAR_azure_client_secret: ${{ secrets.azure_client_secret }}
TF_VAR_subscription_id: ${{ secrets.azure_subscription_id }}
Expand All @@ -136,7 +134,7 @@ jobs:
- name: Terraform Apply
run: terraform apply -auto-approve
env:
TF_VAR_region: 'us-west-1' #replace with your variable and value
TF_VAR_region: "us-west-1" #replace with your variable and value
TF_VAR_azure_client_id: ${{ secrets.azure_client_id }}
TF_VAR_azure_client_secret: ${{ secrets.azure_client_secret }}
TF_VAR_subscription_id: ${{ secrets.azure_subscription_id }}
Expand All @@ -149,4 +147,4 @@ jobs:
TF_VAR_github_personal_access_token: ${{ secrets.github_personal_access_token }}
TF_VAR_environment: ${{ inputs.gh_environment }}
TF_WORKSPACE: ${{ inputs.gh_environment }}
TF_environment: ${{ inputs.gh_environment }}
TF_environment: ${{ inputs.gh_environment }}
49 changes: 24 additions & 25 deletions .github/workflows/tf_plan_server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,62 +4,61 @@ on:
workflow_call:
inputs:
path:
description: 'Specifies the path of the root terraform module.'
description: "Specifies the path of the root terraform module."
required: true
type: string
tf_version:
description: 'Specifies version of Terraform to use. e.g: 1.1.0 Default=latest.'
description: "Specifies version of Terraform to use. e.g: 1.1.0 Default=latest."
required: false
type: string
default: latest
gh_environment:
description: 'Specifies the GitHub deployment environment.'
description: "Specifies the GitHub deployment environment."
required: false
type: string
default: null
tf_vars_file:
description: 'Specifies the Terraform TFVARS file.'
description: "Specifies the Terraform TFVARS file."
required: true
type: string
task_container_version:
description: 'Specifies the version of the container to deploy.'
description: "Specifies the version of the container to deploy."
required: true
type: string
task_container_registry:
description: 'Task Container Registry'
required: true
type: string
description: "Task Container Registry"
required: true
type: string
task_container_name:
description: 'Task Container Name'
required: true
type: string
description: "Task Container Name"
required: true
type: string
secrets:
cli_config_credentials_token:
description: 'CLI configuration credentials token'
description: "CLI configuration credentials token"
required: true
azure_acr_username:
description: 'Azure ACR (Azure Container Registry) username'
description: "Azure ACR (Azure Container Registry) username"
required: true
azure_acr_password:
description: 'Azure ACR (Azure Container Registry) password'
description: "Azure ACR (Azure Container Registry) password"
required: true
azure_tenant_id:
description: 'Azure Tenant ID for the subscription'
description: "Azure Tenant ID for the subscription"
required: true
azure_subscription_id:
description: 'Azure subscription ID'
description: "Azure subscription ID"
required: true
azure_client_id:
description: 'Azure Client ID'
description: "Azure Client ID"
required: true
azure_client_secret:
description: 'Azure Client Secret'
description: "Azure Client Secret"
required: true
github_personal_access_token:
description: 'GitHub Personal Access Token'
description: "GitHub Personal Access Token"
required: true


jobs:
build-plan:
runs-on: ubuntu-latest
Expand All @@ -69,11 +68,11 @@ jobs:
run:
shell: bash
working-directory: ${{ inputs.path }}

steps:
- name: Checkout
uses: actions/[email protected]

- name: Download file
uses: actions/download-artifact@v2
with:
Expand All @@ -92,20 +91,20 @@ jobs:

- name: Terraform Init
env:
GITHUB_TOKEN: ${{ secrets.github_personal_access_token }}
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
TF_WORKSPACE: ${{ inputs.gh_environment }}
run: |
git config --global url."https://x-access-token:${GITHUB_TOKEN}@github.com/".insteadOf "https://github.com/"
terraform init
- name: Terraform Validate
id: validate
run: terraform validate

- name: Terraform Plan
id: plan
env:
TF_VAR_region: 'us-west-1' #replace with your variable and value
TF_VAR_region: "us-west-1" #replace with your variable and value
TF_VAR_azure_client_id: ${{ secrets.azure_client_id }}
TF_VAR_azure_client_secret: ${{ secrets.azure_client_secret }}
TF_VAR_subscription_id: ${{ secrets.azure_subscription_id }}
Expand Down

0 comments on commit 1b92480

Please sign in to comment.