Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/politician/template-terraform
Repository template for a basic (cloud-agnostic) Terraform module.
https://github.com/politician/template-terraform
github terraform terraform-module
Last synced: 2 months ago
JSON representation
Repository template for a basic (cloud-agnostic) Terraform module.
- Host: GitHub
- URL: https://github.com/politician/template-terraform
- Owner: politician
- License: apache-2.0
- Created: 2022-05-30T02:11:32.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-18T02:39:30.000Z (3 months ago)
- Last Synced: 2024-10-18T22:49:13.378Z (3 months ago)
- Topics: github, terraform, terraform-module
- Language: Makefile
- Homepage:
- Size: 275 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: docs/CONTRIBUTING.md
- License: LICENSE.md
- Code of conduct: docs/CODE_OF_CONDUCT.md
- Security: docs/SECURITY.md
Awesome Lists containing this project
README
# USING THIS TEMPLATE
1. Search/replace for these variables:
- `{{repo_owner}}` - GitHub repository username
- `{{repo_name}}` - GitHub repository name
- `{{project_name}}` - Project name
- `{{project_tagline}}` - Project tagline
- `{{security_email}}` - Email to send vulnerabilities add `-noreply` before the `@`
- `{{author_name}}` - Your name
- `{{docs_base_url}}` - Base URL to the documentation (no trailing slash). It could be:
- `https://.github.io/` (GitHub Pages default)
- `https://` (GitHub Pages with CNAME file)
- `https://github.com///blob/main` (if you removed/don't want the documentation site)
- `{{docs_extension}}` - Should be `html` if you use the documentation site, otherwise `md`
- `{{forum_url}}` - URL to your forum for users to ask questions. It could be:
- `https://github.com///discussions` (if you enabled the discussions feature on your repo)
- `https://github.com/orgs//discussions` (if you enabled the discussions feature at your org level)
- `https://` (if you maintain a separate discussion forum, or a link to your community on Slack, Discord, etc.)> For any decent-sized project, it is better to **own** your brand and use your own domain rather than GitHub links.
2. Remove this README.md and move docs/README.md to the root
## GitHub Actions
Some GitHub Actions bundled in this template require a personal access token (PAT). This can be sourced either from an app (recommended) or from a user.
### From an app
1. Create an app [with the minimum permissions](https://github.com/settings/apps/new?&name=-bot&description=Bot%20account&url=https%3A%2F%2Fwww.github.com&user_token_expiration_enabled=true&webhook_active=false&contents=write&issues=write&pull_requests=write) or add the following permissions to an existing app:
- **Contents**: Read and write
- **Issues**: Read and write
- **Pull requests**: Read and write2. Set the `GH_APP_ID` and `GH_APP_PRIVATE_KEY` repository secrets.
3. Install the app to your repository (click `Install App` on the left menu of the app page)### From a user
1. [Create a personal access token](https://github.com/settings/tokens/new?scopes=repo) with the `repo` permissions.
2. Set the `GH_PERSONAL_TOKEN` repository secret.
3. Look into each file in [.github/workflows](https://github.com/{{repo_owner}}/{{repo_name}}/blob/main/.github/workflows):
- Remove every step called `Generate app token`
- Replace `${{ steps.generate_token.outputs.token }}` with `${{ secrets.GH_PERSONAL_TOKEN }}`## Dependency updates
You can pick between [Renovate](https://docs.renovatebot.com/) (recommended) or [Dependabot](https://docs.github.com/en/code-security/dependabot) for your dependency updates.
> Dependabot [won't keep your pre-commit hooks up to date](https://github.com/dependabot/dependabot-core/issues/1524) as opposed to Renovate.
### Renovate
1. [Install it](https://docs.renovatebot.com/getting-started/running/#running-renovate)
2. Remove the file `.github/dependabot.yaml`### Dependabot
Just remove the file `.github/renovate.json`.
## Tests
### Unit tests
This template comes with two types of unit tests: **static code analysis** and **runtime tests** using various tools.
Unit tests are performed on the main module and on each example (eg. `./examples/minimal`)
### Integration tests
This template comes with two ways to test your module actually running `terraform apply` (and `terraform destroy`). Pick the one you prefer and delete the other one:
- Using [Terratest](https://terratest.gruntwork.io/): `./tests/minimal_test.go`
- Using [Terraform tests (experimental)](https://www.terraform.io/language/modules/testing-experiment): `./tests/minimal`> No actual `terraform apply` is run on the `./examples/*` because the two ways above are more suited for actually testing the output.