This is how I do it.
Explore the docs »
Report Bug
.
Request Feature
My opinionated context module that integrates with my other Terraform modules.
This Terraform module simplifies the process of passing common values, such as
project names and namespaces, to ensure consistent naming and tagging across
various Terraform modules. The module normalizes and carries these values in a
compact, ready-to-use format. It's designed to be consumed in conjunction with
the terraform-null-label
module. The context generated by
terraform-null-context
is utilized by terraform-null-label
to produce
consistent names and tags for different components.
module "context" {
source = "bendoerr-terraform-modules/context/null"
version = "xxx"
namespace = "bd"
role = "production"
region = "us-east-1"
project = "example"
}
Project: bendoerr-terraform-modules/terraform-null-context
Name Monthly Qty Unit Monthly Cost
OVERALL TOTAL $0.00
──────────────────────────────────
No cloud resources were detected
This module creates no resources and will not generate any cost against any cloud provider you use.
Name | Version |
---|---|
terraform | >= 0.13 |
Name | Description | Type | Default | Required |
---|---|---|---|---|
attributes | Additional id elements that would be appended. | list(string) |
[] |
no |
context | Allows the merging of an existing context with this one. | any |
{ |
no |
environment | Element to identify the region and/or the role. If not provided this element defaults to <role_short>-<region_short>(-<instance_short>). |
string |
"" |
no |
instance | Element to identify a tenant or copy of an environment (blue-green deployments). This is not used often. |
string |
"" |
no |
instance_short | Shortened version of the 'instance'. Automatic shortening is done by removal of vowels. |
string |
"" |
no |
namespace | Element to ensure resources are generated with names that are globally unique and do not collide. This should be a short key such as initials. |
string |
n/a | yes |
project | Unique identifier for this project | string |
"" |
no |
region | Key for the hosting provider region. | string |
n/a | yes |
region_short | Shortened version of the 'region'. Automatic shortening is done by removal of vowels unless handled by special cases such as 'us-east-1' => 'ue1', or 'us-west-2' => 'uw2'. |
string |
"" |
no |
role | A simple name for the hosting provider account or workspace. Included in tags to ensure that identification is simple across accounts. Examples 'production', 'development', 'main'. |
string |
n/a | yes |
role_short | Shortened version of the 'role'. Automatic shortening is done by removal of vowels unless handled by special cases such as 'production' => 'prod', or 'development' => 'dev'. |
string |
"" |
no |
tags | Additional tags to include. | map(string) |
{} |
no |
Name | Description |
---|---|
attributes | The evaluated attributes |
dns_namespace | A DNS namespace |
environment | The evaluated environment |
instance | The evaluated instance |
instance_short | The evaluated instance |
namespace | The evaluated namespace |
project | The evaluated project |
region | The evaluated region |
region_short | The evaluated region |
role | The evaluated role |
role_short | The evaluated role |
shared | Used for sharing the context with other modules |
tags | The evaluated tags |
See the open issues for a list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- If you have suggestions for adding or removing projects, feel free to open an issue to discuss it, or directly create a pull request after you edit the README.md file with necessary changes.
- Please make sure you check your spelling and grammar.
- Create individual PR for each suggestion.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE for more information.
- Benjamin R. Doerr - Terraformer - Benjamin R. Doerr - Built Ben's Terraform Modules
Only the latest tagged version is supported.
See SECURITY.md.