Skip to main content

Manage Terraform Modules

tfaction's required version: >= v0.5.0 #221

tfaction supports scaffolding, testing, and releasing Terraform Modules.

Please add a file tfaction_module.yaml in the Module directory. tfaction detects Modules with this file. Currently, tfaction doesn't read the content, so there is no problem even if the content is empty.


Test Module


Scaffold Module


💡 If you don't want to create pull requests by GitHub App, please see Support skipping creating pull requests.

Release Module


Instead of Local paths Source, we recommend to create a tag and fix the version by GitHub Source.

💡 Trouble shooting about downloading Private Modules

If it failed to download Private Modules in terraform init, you may have to run gh auth setup-git with GitHub Access Token.

Error of terraform init

Upgrading modules...
Downloading git::***/***.git?ref=*** for ***...

│ Error: Failed to download module

│ Could not download module "***" ( source code
│ from
│ "git::***/***.git?ref=***":
│ error downloading
│ '***/***.git?ref=***':
│ /usr/bin/git exited with 128: Cloning into
│ '.terraform/modules/***'...
│ fatal: could not read Username for '': No such device or
│ address

GitHub Actions Workflow

# This is required to download private modules in `terraform init`
- run: gh auth setup-git
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}

- uses: suzuki-shunsuke/tfaction/setup@v0.5.0
github_app_token: ${{ steps.generate_token.outputs.token }}