Skip to content

bendoerr-terraform-modules/terraform-null-label

Repository files navigation


Logo

Ben's Terraform Null Label Module

This is how I do it.

Explore the docs »

Report Bug . Request Feature

GitHub contributors GitHub issues GitHub pull requests GitHub workflow: Terratest GitHub workflow: Linting GitHub tag (with filter) OSSF-Scorecard Score GitHub License

About The Project

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.

Logo

Usage

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
  ...
}

Cost

infracost

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.

Requirements

Name Version
terraform >= 0.13

Modules

Name Source Version
label cloudposse/label/null 0.25.0

Inputs

Name Description Type Default Required
context Shared Context from Ben's terraform-null-label
object({
attributes = list(string)
dns_namespace = string
environment = string
instance = string
instance_short = string
namespace = string
region = string
region_short = string
role = string
role_short = string
project = string
tags = map(string)
})
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

Outputs

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

Roadmap

GitHub issues

See the open issues for a list of proposed features (and known issues).

Contributing

GitHub pull requests

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.

Creating A Pull Request

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

GitHub License

Distributed under the MIT License. See LICENSE for more information.

Authors

GitHub contributors

  • Benjamin R. Doerr - Terraformer - Benjamin R. Doerr - Built Ben's Terraform Modules

Supported Versions

Only the latest tagged version is supported.

Reporting a Vulnerability

See SECURITY.md.

Acknowledgements