This repository is meant to be a template for creating new terraform modules.
- Clone this repo, renaming appropriately.
- Write your terraform code in the root dir.
- Ensure you've completed the Developer Setup.
- In the root dir, modify the
module
line for the repo path. Then runmake tidy
, which updates thego.sum
file and downloads dependencies. - Update the terratest tests in the examples and test directories.
- Run your terratest tests to ensure they work as expected using instructions below.
Please put a description of what this module does here
Add Usage information here
Resources:
module "example" {
source = "dod-iac/example/aws"
tags = {
Project = var.project
Application = var.application
Environment = var.environment
Automation = "Terraform"
}
}
Run all terratest tests using the terratest
script. If using aws-vault
, you could use aws-vault exec $AWS_PROFILE -- terratest
. The AWS_DEFAULT_REGION
environment variable is required by the tests. Use TT_SKIP_DESTROY=1
to not destroy the infrastructure created during the tests. Use TT_VERBOSE=1
to log all tests as they are run. Use TT_TIMEOUT
to set the timeout for the tests, with the value being in the Go format, e.g., 15m. The go test command can be executed directly, too.
Terraform 0.13. Pin module version to ~> 1.0.0 . Submit pull-requests to master branch.
Terraform 0.11 and 0.12 are not supported.
This project constitutes a work of the United States Government and is not subject to domestic copyright protection under 17 USC § 105. However, because the project utilizes code licensed from contributors and other third parties, it therefore is licensed under the MIT License. See LICENSE file for more information.
This template is configured to use aws-vault, direnv, go, pre-commit, terraform-docs, and tfenv. If using Homebrew on macOS, you can install the dependencies using the following code.
brew install aws-vault direnv go pre-commit terraform-docs tfenv
pre-commit install --install-hooks
If using direnv
, add a .envrc.local
that sets the default AWS region, e.g., export AWS_DEFAULT_REGION=us-west-2
.
If using tfenv
, then add a .terraform-version
to the project root dir, with the version you would like to use.
Name | Version |
---|---|
terraform | >= 0.13 |
aws | ~> 3.0 |
Name | Version |
---|---|
aws | ~> 3.0 |
No modules.
Name | Type |
---|---|
aws_caller_identity.current | data source |
aws_iam_account_alias.current | data source |
aws_partition.current | data source |
aws_region.current | data source |
Name | Description | Type | Default | Required |
---|---|---|---|---|
tags | Tags applied to the AWS resources. | map(string) |
{} |
no |
No outputs.