{"id":19854640,"url":"https://github.com/obytes/terraform-aws-tag","last_synced_at":"2025-10-16T07:02:04.393Z","repository":{"id":77139372,"uuid":"353700529","full_name":"obytes/terraform-aws-tag","owner":"obytes","description":"Terraform module to automate creation of AWS tags and Name Attribute","archived":false,"fork":false,"pushed_at":"2022-08-08T19:33:44.000Z","size":56,"stargazers_count":3,"open_issues_count":0,"forks_count":4,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-01-11T13:50:07.635Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/obytes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-01T12:57:27.000Z","updated_at":"2024-06-13T19:22:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"986bca22-9766-4df0-8bad-7c00e3e53fc2","html_url":"https://github.com/obytes/terraform-aws-tag","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obytes%2Fterraform-aws-tag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obytes%2Fterraform-aws-tag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obytes%2Fterraform-aws-tag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obytes%2Fterraform-aws-tag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/obytes","download_url":"https://codeload.github.com/obytes/terraform-aws-tag/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241244426,"owners_count":19933291,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T14:10:00.887Z","updated_at":"2025-10-16T07:01:59.361Z","avatar_url":"https://github.com/obytes.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Summary\nA Terraform open-source module to automate the creation of `tags`, the `Name` key  and other attributes across resources in AWS, the `Name` prefix is based on a customizable order passed by the `prefix_order` variable with a default value of `[\"enviroemnt\", \"project_name\", \"region\", \"name\", \"attributes\"]` and a configurable `delimiter` variable with value of `-`.\n\n## Features\n\nThe module supports the following:\n - Optionally limiting the `id` variable length to a specific number of chars by modifying the `prefix_lenght_limit` variable, defaulted to 0 which means no limit.\n - Optionally configure the case letter of `tag_key_case` and `tag_value_case`, defaults to `title`, `lower` respectively.\n - A random string will be created using the `random` provider that will be used in case of creating a truncated id, `prefix_legnth_limit` !=0.\n - Supporting a configurable `regex_substitute_chars` variable which will replace any non-alphanumeric chars passed to `enviroment`, `project_name`, `region` and, `name`, defaulted to `\"/[^(a-z)(A-Z)(0-9)$]/\"`.\n - A validation mechanism to validate some input variables e.g. `tag_key_case`, `tag_value_case`, `region`\n - Optional `attributes` which will be added automatically to `tags` variable and `id`\n\n## Usage\n### Example 1\n```hcl\nmodule \"label\" {\n  source = \"github.com/obytes/terraform-aws-tag.git?ref=v1.0.7\"\n  environment = \"dev\"\n  project_name = \"obytes\"\n  region = \"me-south-1\"\n  delimiter = \"+\"\n  attributes  = [\"private\"]\n  enabled = true\n  prefix_length_limit = 10\n}\n```\nThe above example will generate the below output that can be passed to another `label` module to create a new `id` that has the base values used on `label_1` module \n\n```hcl\ncontext = {\n  \"additional_tags\" = {}\n  \"attributes\" = [\n    \"private\",\n  ]\n  \"delimiter\" = \"+\"\n  \"enabled\" = \"true\"\n  \"environment\" = \"dev\"\n  \"prefix_length_limit\" = 10\n  \"prefix_order\" = [\n    \"environment\",\n    \"project_name\",\n    \"region\",\n    \"name\",\n  ]\n  \"project_name\" = \"obytes\"\n  \"region\" = \"me-south-1\"\n  \"tag_key_case\" = \"title\"\n  \"tag_value_case\" = \"lower\"\n  \"tags\" = {}\n}\nid = dev+n4rnkc\ntags = {\n  \"Attributes\" = \"private\"\n  \"Environment\" = \"dev\"\n  \"Name\" = \"dev+n4rnkc\"\n  \"Project_name\" = \"obytes\"\n  \"Region\" = \"mesouth1\"\n}\n```\nCheck the example folder for more details scenarios.\n\n## Requirements\n\n| Name | Version |\n|------|---------|\n| \u003ca name=\"requirement_terraform\"\u003e\u003c/a\u003e [terraform](#requirement\\_terraform) | \u003e=0.13.0 |\n| \u003ca name=\"requirement_random\"\u003e\u003c/a\u003e [random](#requirement\\_random) | 3.1.0 |\n\n## Providers\n\n| Name | Version |\n|------|---------|\n| \u003ca name=\"provider_random\"\u003e\u003c/a\u003e [random](#provider\\_random) | 3.1.0 |\n\n## Modules\n\nNo modules.\n\n## Resources\n\n| Name | Type |\n|------|------|\n| [random_string.this](https://registry.terraform.io/providers/hashicorp/random/3.1.0/docs/resources/string) | resource |\n\n## Inputs\n\n| Name | Description | Type | Default | Required |\n|------|-------------|------|---------|:--------:|\n| \u003ca name=\"input_additional_tags\"\u003e\u003c/a\u003e [additional\\_tags](#input\\_additional\\_tags) | Additional Tags, tags which can be accessed by module.\u003cname\u003e.tags\\_as\\_list not added to \u003cmodule\u003e.\u003cname\u003e.\u003ctags\u003e | `map(string)` | `{}` | no |\n| \u003ca name=\"input_attributes\"\u003e\u003c/a\u003e [attributes](#input\\_attributes) | A list of attributes e.g. `private`, `shared`, `cost_center` | `list(string)` | `null` | no |\n| \u003ca name=\"input_company_name\"\u003e\u003c/a\u003e [company\\_name](#input\\_company\\_name) | The company name or client name, could be fullName or abbreviation such as `ex` | `string` | `null` | no |\n| \u003ca name=\"input_context\"\u003e\u003c/a\u003e [context](#input\\_context) | n/a | `any` | \u003cpre\u003e{\u003cbr\u003e  \"additional_tags\": {},\u003cbr\u003e  \"attributes\": [],\u003cbr\u003e  \"company_name\": null,\u003cbr\u003e  \"delimiter\": null,\u003cbr\u003e  \"enabled\": true,\u003cbr\u003e  \"environment\": null,\u003cbr\u003e  \"prefix_length_limit\": 0,\u003cbr\u003e  \"prefix_order\": [\u003cbr\u003e    \"environment\",\u003cbr\u003e    \"project_name\",\u003cbr\u003e    \"company_name\",\u003cbr\u003e    \"region\",\u003cbr\u003e    \"attributes\"\u003cbr\u003e  ],\u003cbr\u003e  \"project_name\": null,\u003cbr\u003e  \"random_string\": null,\u003cbr\u003e  \"regex_substitute_chars\": null,\u003cbr\u003e  \"region\": null,\u003cbr\u003e  \"tag_key_case\": \"title\",\u003cbr\u003e  \"tag_value_case\": \"lower\",\u003cbr\u003e  \"tags\": {}\u003cbr\u003e}\u003c/pre\u003e | no |\n| \u003ca name=\"input_delimiter\"\u003e\u003c/a\u003e [delimiter](#input\\_delimiter) | Delimiter to be used between `project_name`, `environment`, `region` and, `name`.\u003cbr\u003eDefaults to `-` (hyphen). Set to `\"\"` to use no delimiter at all. | `string` | `null` | no |\n| \u003ca name=\"input_enabled\"\u003e\u003c/a\u003e [enabled](#input\\_enabled) | A boolean to enable or disable tagging/labeling module | `string` | `null` | no |\n| \u003ca name=\"input_environment\"\u003e\u003c/a\u003e [environment](#input\\_environment) | Environment, the environment name such as 'stg', 'prd', 'dev' | `string` | `null` | no |\n| \u003ca name=\"input_prefix_length_limit\"\u003e\u003c/a\u003e [prefix\\_length\\_limit](#input\\_prefix\\_length\\_limit) | The minimum number of chars required for the id/Name desired (minimum =7)\u003cbr\u003eSet it to `0` for unlimited number of chars, `full_id` | `number` | `null` | no |\n| \u003ca name=\"input_prefix_order\"\u003e\u003c/a\u003e [prefix\\_order](#input\\_prefix\\_order) | The order of the Name tag\u003cbr\u003eDefaults to, `[\"environment\", \"project_name\", \"region\", \"name\"]`\u003cbr\u003eat least one should be provided | `list(string)` | `null` | no |\n| \u003ca name=\"input_project_name\"\u003e\u003c/a\u003e [project\\_name](#input\\_project\\_name) | The project name or organization name, could be fullName or abbreviation such as `ex` | `string` | `null` | no |\n| \u003ca name=\"input_random_string\"\u003e\u003c/a\u003e [random\\_string](#input\\_random\\_string) | A Random string, that will be appended to `id` in case of using `prefix_length_limit`\u003cbr\u003eUsing the default value which is `null`, the string will be created using the `random` terraform provider | `string` | `null` | no |\n| \u003ca name=\"input_regex_substitute_chars\"\u003e\u003c/a\u003e [regex\\_substitute\\_chars](#input\\_regex\\_substitute\\_chars) | a regex to replace empty chars in `project_name`, `environment`, `region` and, `name`\u003cbr\u003edefaults to `\"\\[a-zA-Z0-9]\\\"`, replacing any chars other than chars and digits | `string` | `null` | no |\n| \u003ca name=\"input_region\"\u003e\u003c/a\u003e [region](#input\\_region) | Environment name such as us-east-1, ap-west-1, eu-central-1 | `string` | `null` | no |\n| \u003ca name=\"input_tag_key_case\"\u003e\u003c/a\u003e [tag\\_key\\_case](#input\\_tag\\_key\\_case) | The letter case of output tag keys\u003cbr\u003ePossible values are `lower', `upper` and `title`\u003cbr\u003edefaults to `title`\u003cbr\u003e` | `string` | `null` | no |\n| \u003ca name=\"input_tag_value_case\"\u003e\u003c/a\u003e [tag\\_value\\_case](#input\\_tag\\_value\\_case) | The letter case of output tag values\u003cbr\u003ePossible values are `lower', `upper` and `title`\u003cbr\u003edefaults to `lower`\u003cbr\u003e` | `string` | `null` | no |\n| \u003ca name=\"input_tags\"\u003e\u003c/a\u003e [tags](#input\\_tags) | Tags, Tags to be generated by this module which can be access by module.\u003cname\u003e.tags e.g. map('CostCenter', 'Production') | `map(string)` | `{}` | no |\n\n## Outputs\n\n| Name | Description |\n|------|-------------|\n| \u003ca name=\"output_additional_tags\"\u003e\u003c/a\u003e [additional\\_tags](#output\\_additional\\_tags) | Additional Tags, tags which can be accessed by module.\u003cname\u003e.tags\\_as\\_list not added to \u003cmodule\u003e.\u003cname\u003e.\u003ctags\u003e |\n| \u003ca name=\"output_attributes\"\u003e\u003c/a\u003e [attributes](#output\\_attributes) | A list of attributes e.g. `private`, `shared`, `cost_center` |\n| \u003ca name=\"output_company_name\"\u003e\u003c/a\u003e [company\\_name](#output\\_company\\_name) | The name of the company or client |\n| \u003ca name=\"output_context\"\u003e\u003c/a\u003e [context](#output\\_context) | A context to be used as an input for other modules |\n| \u003ca name=\"output_delimiter\"\u003e\u003c/a\u003e [delimiter](#output\\_delimiter) | Delimiter to be used between `project_name`, `environment`, `region` and, `name`. |\n| \u003ca name=\"output_enabled\"\u003e\u003c/a\u003e [enabled](#output\\_enabled) | A boolean to enable or disable tagging/labeling module |\n| \u003ca name=\"output_environment\"\u003e\u003c/a\u003e [environment](#output\\_environment) | Environment name passed to module such as us-east-1, ap-west-1, eu-central-1 |\n| \u003ca name=\"output_id\"\u003e\u003c/a\u003e [id](#output\\_id) | ID, restricted to `prefix_length_limit` if set otherwise, full ID |\n| \u003ca name=\"output_id_full\"\u003e\u003c/a\u003e [id\\_full](#output\\_id\\_full) | Full ID, not restricted to prefix\\_length\\_limit |\n| \u003ca name=\"output_prefix_order\"\u003e\u003c/a\u003e [prefix\\_order](#output\\_prefix\\_order) | an ordered list of strings that forms the `ID` attribute |\n| \u003ca name=\"output_project_name\"\u003e\u003c/a\u003e [project\\_name](#output\\_project\\_name) | The project name or organization name, could be fullName or abbreviation such as `ex` |\n| \u003ca name=\"output_random_string\"\u003e\u003c/a\u003e [random\\_string](#output\\_random\\_string) | A random string, used in `id` and `id_short` in case of setting `prefix_lenght_limit` |\n| \u003ca name=\"output_regex_substitute_chars\"\u003e\u003c/a\u003e [regex\\_substitute\\_chars](#output\\_regex\\_substitute\\_chars) | Regex, to be used for id substitution in case of using `prefix_length_limit` |\n| \u003ca name=\"output_tags\"\u003e\u003c/a\u003e [tags](#output\\_tags) | Tags, Tags to be generated by this module which can be access by module.\u003cname\u003e.tags e.g. map('CostCenter', 'Production') |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fobytes%2Fterraform-aws-tag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fobytes%2Fterraform-aws-tag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fobytes%2Fterraform-aws-tag/lists"}