3.0 KiB
Creating modules for AWS I&A Organization
This repo template is used to seed Terraform Module templates for the AWS I&A GitHub organization. Usage of this template is allowed per included license. PRs to this template will be considered but are not guaranteed to be included. Consider creating an issue to discuss a feature you want to include before taking the time to create a PR.
TL;DR
- install pre-commit
- configure pre-commit:
pre-commit install - install required tools
- tflint
- tfsec
- terraform-docs
- golang (for macos you can use
brew) - coreutils
Write code according to I&A module standards
Module Documentation
Do not manually update README.md. terraform-docs is used to generate README files. For any instructions an content, please update .header.md then simply run terraform-docs ./ or allow the pre-commit to do so.
Terratest
Please include tests to validate your examples/<> root modules, at a minimum. This can be accomplished with usually only slight modifications to the boilerplate test provided in this template
Configure and run Terratest
-
Install
golang (for macos you can use
brew) -
Change directory into the test folder.
cd test -
Initialize your test
go mod init github.com/[github org]/[repository]
go mod init github.com/aws-ia/terraform-aws-vpc -
Run tidy
git mod tidy -
Install Terratest
go get github.com/gruntwork-io/terratest/modules/terraform -
Run test (You can have multiple test files).
-
Run all tests
go test -
Run a specific test with a timeout
go test -run examples_basic_test.go -timeout 45m
-
Module Standards
For best practices and information on developing with Terraform, see the I&A Module Standards
Continuous Integration
The I&A team uses AWS CodeBuild to perform continuous integration (CI) within the organization. Our CI uses the a repo's .pre-commit-config.yaml file as well as some other checks. All PRs with other CI will be rejected. See our FAQ for more details.
Requirements
| Name | Version |
|---|---|
| terraform | >= 0.14.0 |
| aws | >= 4.0.0, < 5.0.0 |
| awscc | >= 0.24.0 |
Providers
No providers.
Modules
No modules.
Resources
No resources.
Inputs
No inputs.
Outputs
No outputs.