GitHub Action
API Integration - Github Actions Terraform
v0.1.0
Latest version
Sets up Terraform API in your GitHub Actions workflow.
This project arose in the need to create dynamic environment with Terraform Cloud interaction.
- We had a problem when creating an environment variable in the Terraform Cloud workspace that would be used to define STAGE in the AWS API Gateway depending on the branch used. example: main: stage -> prod and develop: stage dev
The Mona-bele/action-integration-terraform
action is used to set up Terraform API in your GitHub Actions workflow.
name: Terraform API
on:
push:
branches:
- main
jobs:
terraform-apply:
name: 'Terraform'
runs-on: ubuntu-latest
environment: production
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Terraform API Integration Create Variable
uses: Mona-bele/action-integration-terraform@v1
with:
tf_api_token: ${{ secrets.TF_API_TOKEN }}
tf_workspace: ${{ env.workspace }}
tf_organization: ${{ env.organization }}
tf_run_type: 'variable_create'
tf_variable_key: 'test'
tf_variable_value: 'test'
tf_variable_category: 'terraform'
tf_variable_sensitive: 'false'
tf_variable_hcl: 'false'
tf_variable_description: 'test'
- name: Terraform API Integration Delete Variable
uses: Mona-bele/action-integration-terraform@v1
with:
tf_api_token: ${{ secrets.TF_API_TOKEN }}
tf_workspace: ${{ env.workspace }}
tf_organization: ${{ env.organization }}
tf_run_type: 'variable_delete'
tf_variable_key: 'test'
action-integration-terraform is licensed under the MIT License.