GitHub Action to scans Terraform files in a specified directory to find and extract the AWS region configuration from the aws provider block. This is useful for workflows that need to know which AWS region is being used in a monorepo Terraform project without manually specifying it.
Works with both Terraform and OpenToFu
The AWS region extracted from the Terraform files.
Required: false
Default: "."
Directory to search for Terraform files
Required: false
Name of tfvars file within the terraform_directory
steps:
- uses: actions/checkout@v4
- name: Get AWS Region
uses: VIOOH/get-region-action@v1
id: get-region
with:
terraform_directory: 'path/to/terraform/files'
tfvars_file: 'terraform.tfvars'
- name: Use the region
run: |
echo "The region is ${{ steps.get-region.outputs.region }}"