https://github.com/terraform-google-modules/terraform-google-module-template
Provides a template for creating a Cloud Foundation Toolkit Terraform module
https://github.com/terraform-google-modules/terraform-google-module-template
cft-terraform
Last synced: 4 months ago
JSON representation
Provides a template for creating a Cloud Foundation Toolkit Terraform module
- Host: GitHub
- URL: https://github.com/terraform-google-modules/terraform-google-module-template
- Owner: terraform-google-modules
- License: apache-2.0
- Created: 2019-01-14T17:34:30.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-12-20T20:15:46.000Z (6 months ago)
- Last Synced: 2024-12-28T07:18:01.068Z (5 months ago)
- Topics: cft-terraform
- Language: HCL
- Homepage: https://registry.terraform.io/modules/terraform-google-modules/module-template/google
- Size: 240 KB
- Stars: 56
- Watchers: 23
- Forks: 38
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# CFT Module Template
A template for starting a Cloud Foundation Toolkit Terraform module.
## Usage
The template must be rendered using [Cookiecutter][cookiecutter].
Generate a new module by running the following command:
`cookiecutter https://github.com/terraform-google-modules/terraform-google-module-template.git`
## Generated Module
A newly generated module includes logic to create a Google Cloud
Storage bucket, a functional example module, and
[Kitchen-Terraform][kitchen-terraform] integration tests. All of this
content should be modified to suit the purpose of the new module.## Testing
Changes to this template must be tested to ensure that generated
modules remain functional.Refer to the [README][./terraform-google-{{cookiecutter.module_name}}/README.md] and [CONTRIBUTING][./terraform-google-{{cookiecutter.module_name}}/CONTRIBUTING.md]
documents of the template to understand the requirements for testing
the generated module.Export a Service Account key and env variables:
```
export SERVICE_ACCOUNT_JSON=$(< credentials.json)
export TF_VAR_org_id="your_org_id"
export TF_VAR_folder_id="your_folder_id"
export TF_VAR_billing_account="your_billing_account_id"
```Generate a module and execute its tests by running the following
command:```sh
make test
```The module will be generated at
`./staging/terraform-google-module-test`. If the tests pass, the module
will be removed; otherwise, it will be left in place for inspection.In order to execute the test following tools need to be installed:
- `make`
- `docker`[cookiecutter]: https://cookiecutter.readthedocs.io/
[kitchen-terraform]: https://github.com/newcontext-oss/kitchen-terraform
[contributing]: ./terraform-google-{{cookiecutter.module_name}}/CONTRIBUTING.md
[readme]: ./terraform-google-{{cookiecutter.module_name}}/README.md