Terraform Modules Template Project
Submit a new module
👍🎉 Thank you for taking the time to contribute! 🎉👍
This template repository exists to help you create Terraform modules for IBM Cloud.
The default structure includes the following files:
README.md
: A description of the modulemain.tf
: The logic for the moduleversion.tf
: The required terraform and provider versionsvariables.tf
: The input variables for the moduleoutputs.tf
: The values that are output from the module For more information, see Module structure in the project documentation.
You can add other content to support what your module does and how it works. For example, you might add a scripts/
directory that contains shell scripts that are run by a local-exec
null_resource
in the Terraform module.
Follow this process to create and submit a Terraform module.
Create a repo from this repo template
- Create a repository from this repository template by clicking
Use this template
in the upper right of the GitHub UI.
For more information about creating a repository from a template, see the GitHub docs. - Select
terraform-ibm-modules
as the owner. - Enter a name for the module in format
terraform-ibm-<NAME>
, where<NAME>
reflects the type of infrastructure that the module manages.
Use hyphens as delimiters for names with multiple words (for example, terraform-ibm-activity-tracker
). - Provide a short description of the module.
The description is displayed under the repository name on the organization page and in the About section of the repository. Use the description to help users understand the purpose of your module. For more information, see module names and descriptions in the docs.
Clone the repo and set up your development environment
Locally clone the new repository and set up your development environment by completing the tasks in Local development setup in the project documentation.
Update the repo name and description in source control
To help make sure that the repo name and description are not changed except through pull requests, they are defined in the settings.yml
file.
Check to make sure that values are uncommented and correct:
- Open the settings.yml file.
- If not already updated, uncomment the
name
anddescription
properties and set the values to what you specified when you requested the repo.
Update the Terraform files
Implement the logic for your module by updating the main.tf
, version.tf
, variables.tf
, and outputs.tf
Terraform files. For more information, see Creating Terraform on IBM Cloud templates.
Create examples and tests
Add one or more examples in the examples
directory that consume your new module, and configure tests for them in the tests
directory. For more information about tests, see Tests.
Update the content in the readme file
After you implement the logic for your module and create examples and tests, update this readme file in your repository by following these steps:
- Update the title heading and add a description about your module.
- Update the badge links.
- Remove all the content in this H2 heading section.
- Complete the Usage and Required IAM access policies sections. The Examples and Requirements section are populated by a pre-commit hook.
Commit your code and submit your module for review
- Before you commit any code, review Contributing to the IBM Cloud Terraform modules project in the project documentation.
- Create a pull request for review.
Post-merge steps
After the first PR for your module is merged, follow these post-merge steps:
- Create a PR to enable the upgrade test by removing the
t.Skip
line intests/pr_test.go
.
Usage
Required IAM access policies
Examples
Requirements
Name | Version |
---|---|
terraform | >= 1.0.0 |
Modules
No modules.
Resources
No resources.
Inputs
No inputs.
Outputs
No outputs.
Contributing
You can report issues and request features for this module in GitHub issues in the module repo. See Report an issue or request a feature.
To set up your local development environment, see Local development setup in the project documentation.