This is how I do it.
Explore the docs »
Report Bug
.
Request Feature
My opinionated label module.
This Terraform module consumes my terraform-null-context
and produces
consistent names and tags for all of my resources. It implements a strict naming
and tagging convention that follows the format from
cloudposse/terraform-null-label.
The Cloud Posse label module provides detailed documentation and reasoning however by itself it has too many knobs and provides more options that I use. This module configures the Cloud Posse label exactly how I like it while taking advantage of my context module to carry standard part of the label around.
module "context" {
source = "bendoerr-terraform-modules/context/null"
version = "xxx"
namespace = "bd"
role = "production"
region = "us-east-1"
project = "example"
}
module "label" {
source = "bendoerr-terraform-modules/label/null"
version = "xxx"
context = module.context.shared
name = "function"
}
resource "aws_lambda_function" "function" {
function_name = module.label.id # bd-prd-ue1-example-function
tags = module.label.tags # { Name: bd-prd-ue1-example-function,
# Namespace: bd,
# Role: production,
# Region: us-east-1,
# Project: example,
# Environment: prod-ue1,
# }
...
}
resource "aws_route53_record" "function" {
name = "${module.label.dns_name}.${vars.zone_name}" # function.ue1.cloud.bendoerr.me
# assuming vars.zone_name = cloud.bendoerr.me
...
}
Project: bendoerr-terraform-modules/terraform-null-label
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 | Source | Version |
---|---|---|
label | cloudposse/label/null | 0.25.0 |
Name | Description | Type | Default | Required |
---|---|---|---|---|
context | Shared Context from Ben's terraform-null-label | object({ |
n/a | yes |
name | Name of this resource | string |
n/a | yes |
project | Name of the project or application, this can override the context's project | string |
"" |
no |
Name | Description |
---|---|
attributes | List of attributes |
delimiter | Delimiter between namespace , environment , stage , name and attributes |
dns_name | Normalized DNS Name |
environment | Normalized environment |
id | Disambiguated ID |
label_order | The naming order of the id output and Name tag |
name | Normalized name |
namespace | Normalized namespace |
project | Normalized project |
tags | Normalized Tag map |
tags_as_list_of_maps | Additional tags as a list of maps, which can be used in several AWS resources |
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.