Skip to content

Commit b31b178

Browse files
author
Om Sharma
authored
Merge pull request #88 from clouddrove/internal_357
feat: Added attribute to pass environment variables as a input
2 parents 51d21c1 + 42f17d2 commit b31b178

File tree

2 files changed

+7
-19
lines changed

2 files changed

+7
-19
lines changed

.github/workflows/terraform_workflow.yml

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -69,28 +69,14 @@ on:
6969
PROJECT_ID:
7070
required: false
7171
description: 'GCP Secret access key to install GCP CLI'
72-
DIGITALOCEAN_ACCESS_TOKEN:
72+
env-vars:
7373
required: false
74-
description: 'Digitalocean access Token to install Digitalocean CLI'
75-
SPACES_ACCESS_KEY_ID:
76-
required: false
77-
description: 'Spaces access key ID for digitalocean if required'
78-
SPACES_SECRET_ACCESS_KEY:
79-
required: false
80-
description: 'Spaces secret access key for digitalocean if required'
81-
TF_VAR_access_token:
82-
required: false
83-
description: 'TF var access token'
74+
description: 'Pass required environment variables'
8475

8576
jobs:
8677
terraform-workflow:
8778
runs-on: ubuntu-latest
88-
env:
89-
ARM_SKIP_PROVIDER_REGISTRATION: true
90-
DIGITALOCEAN_TOKEN: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
91-
SPACES_ACCESS_KEY_ID: ${{ secrets.SPACES_ACCESS_KEY_ID }}
92-
SPACES_SECRET_ACCESS_KEY: ${{ secrets.SPACES_SECRET_ACCESS_KEY }}
93-
TF_VAR_access_token: ${{ secrets.TF_VAR_access_token }}
79+
env: ${{ fromJSON(secrets.env-vars) }}
9480
outputs:
9581
tfplanExitCode: ${{ steps.tf-plan.outputs.exitcode }}
9682

docs/terraform_workflow.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ jobs:
3030
AWS_ACCESS_KEY_ID: # Specify AWS Access key ID
3131
AWS_SECRET_ACCESS_KEY: # Specify AWS Secret Access key ID
3232
AWS_SESSION_TOKEN: # Specify Session ID
33+
env-vars: # Specify env variables. ex. '{"KEY1":"VALUE1", "KEY2":" ${{ secrets.VALUE2 }}"}'
3334

3435
```
3536

@@ -55,6 +56,7 @@ jobs:
5556
destroy: # If the value is set to true, the workflow proceeds to the destroy step. However, the default value is false
5657
secrets:
5758
AZURE_CREDENTIALS: # Specify Azure credentilas
59+
env-vars: # Specify env variables. ex. '{"KEY1":"VALUE1", "KEY2":" ${{ secrets.VALUE2 }}"}'
5860
```
5961
6062
#### Example of a Terraform workflow for a Digitalocean cloud provider
@@ -79,8 +81,7 @@ jobs:
7981
destroy: # If the value is set to true, the workflow proceeds to the destroy step. However, the default value is false
8082
secrets:
8183
DIGITALOCEAN_ACCESS_TOKEN: # Digitalocean token
82-
SPACES_ACCESS_KEY_ID: # Provide spaces access key id if required
83-
SPACES_SECRET_ACCESS_KEY: # Provide spaces secret access key if required
84+
env-vars: # Specify env variables. ex. '{"KEY1":"VALUE1", "KEY2":" ${{ secrets.VALUE2 }}"}'
8485
```
8586
8687
#### Example of a Terraform workflow for a GCP cloud provider
@@ -105,4 +106,5 @@ jobs:
105106
destroy: # If the value is set to true, the workflow proceeds to the destroy step. However, the default value is false
106107
secrets:
107108
GCP_SA_KEY: # GCP service account Secret access key
109+
env-vars: # Specify env variables. ex. '{"KEY1":"VALUE1", "KEY2":" ${{ secrets.VALUE2 }}"}'
108110
```

0 commit comments

Comments
 (0)