Use this template repository to create new OpenTofu modules. Follow the steps below to use this repository:
- Click the "Use this template" button to create a new repository
- Name your new repository using the format
todu-modules-<provider>-<module> - Update the repository Pull Requests settings to allow only squash merging with a default commit message of "Pull request title and commit details" for automated releases
- Add the files necessary to support your module to the root of your new repository
- Update the
README.mdfile with the appropriate information for your module. Make sure you update any references to this template repository with your new repository - Update the codeforamerica/tofu-modules repository to include
your new module in the main
README.mdand the documentation
Add this module to your main.tf (or appropriate) file and configure the inputs
to match your desired configuration. For example:
module "module_name" {
source = "github.com/codeforamerica/tofu-modules-template?ref=1.0.0"
project = "my-project"
environment = "development"
}Make sure you re-run tofu init after adding the module to your configuration.
tofu init
tofu planTo update the source for this module, pass -upgrade to tofu init:
tofu init -upgrade| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| project | Name of the project. | string |
n/a | yes |
| environment | Environment for the project. | string |
"dev" |
no |
| tags | Optional tags to be applied to all resources. | list |
[] |
no |
| Name | Description | Type |
|---|---|---|
| id | Id of the newly created resource. | string |
This repository uses pre-commit to enforce code style checks before each commit. Install it once after cloning:
1. Install pre-commit
brew install pre-commit2. Install the git hook
pre-commit installThis symlinks the hook into .git/hooks/pre-commit. The checks will now run
automatically on every git commit. To run them manually against all files:
pre-commit run --all-filesFollow the contributing guidelines to contribute to this repository.