Skip to content

Terraform module to output values in a consistent way for consistent naming

License

Notifications You must be signed in to change notification settings

MagnetarIT/terraform-naming-standard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

terraform-naming-standard

Terraform (>= 0.12.0) module to output values in a consistent way for consistent naming


Example

module "simple" {
    source     = "git::https://github.com/MagnetarIT/terraform-naming-standard.git?ref=tags/0.1.0"
    namespace  = "mag"
    name       = "app"
    attributes = ["test"]
  }

output "tags_as_list_of_maps" {
  value = module.simple.tags_as_list_of_maps
}

output "tags" {
  value = module.simple.tags
}

output "id" {
  value = module.simple.id
}

Intro

This module will return values formatted in a consistent way. This can be used to ensure all other modules conform to the same standard.


Inputs

Name Description Type Default Required
additional_tag_map Additional tags for appending to each tag map map(string) {} no
attributes Additional attributes (e.g. 1) list(string) [] no
context Default context to use for passing state between label invocations
object({
namespace = string
environment = string
name = string
enabled = bool
delimiter = string
attributes = list(string)
label_order = list(string)
tags = map(string)
additional_tag_map = map(string)
regex_replace_chars = string
})
{
"additional_tag_map": {},
"attributes": [],
"delimiter": "",
"enabled": true,
"environment": "",
"label_order": [],
"name": "",
"namespace": "",
"regex_replace_chars": "",
"tags": {}
}
no
delimiter Delimiter to be used between namespace, environment, stage, name and attributes string "-" no
enabled Set to false to prevent the module from creating any resources bool true no
environment Environment, e.g. 'prod', 'staging', 'dev', 'pre-prod', 'UAT' string "" no
label_order The naming order of the id output and Name tag list(string) [] no
name Solution name, e.g. 'app' or 'jenkins' string "" no
namespace Namespace, which could be your team, business name or abbreviation, e.g. 'mag' or 'tar' string "" no
regex_replace_chars Regex to replace chars with empty string in namespace, environment and name. By default only hyphens, letters and digits are allowed, all other chars are removed string "/[^a-zA-Z0-9-]/" no
tags Additional tags (e.g. map('BusinessUnit','XYZ') map(string) {} no

Outputs

Name Description
asg_tags_as_list_of_maps ASG tags as a list of maps with propagate_at_launch = true.
attributes List of attributes
context Context of this module to pass to other label modules
delimiter Delimiter between namespace, environment, name and attributes
environment Normalized environment
id Disambiguated ID
label_order The naming order of the id output and Name tag
name Normalized name
namespace Normalized namespace
tags Normalized Tag map
tags_as_list_of_maps Additional tags as a list of maps, which can be used in several AWS resources

Support

Reach out to me at one of the following places!


License

License

See LICENSE for full details.

Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

  https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.

Original sourced from https://github.com/cloudposse/terraform-null-label

About

Terraform module to output values in a consistent way for consistent naming

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages