{"id":14957876,"url":"https://github.com/cloudposse/terraform-terraform-label","last_synced_at":"2025-04-04T14:04:51.317Z","repository":{"id":34726415,"uuid":"132816540","full_name":"cloudposse/terraform-terraform-label","owner":"cloudposse","description":"Terraform Module to define a consistent naming convention by (namespace, stage, name, [attributes])","archived":false,"fork":false,"pushed_at":"2024-10-11T03:09:51.000Z","size":4194,"stargazers_count":118,"open_issues_count":0,"forks_count":59,"subscribers_count":20,"default_branch":"main","last_synced_at":"2025-03-28T13:05:30.864Z","etag":null,"topics":["hcl2","label","naming-convention","terraform","terraform-module"],"latest_commit_sha":null,"homepage":"https://cloudposse.com/accelerate","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloudposse.png","metadata":{"funding":{"github":"cloudposse"},"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-09T21:51:57.000Z","updated_at":"2025-03-18T21:49:02.000Z","dependencies_parsed_at":"2024-04-10T23:30:49.154Z","dependency_job_id":"94f3d2ea-c15e-499a-aaf0-b4db38312d60","html_url":"https://github.com/cloudposse/terraform-terraform-label","commit_stats":{"total_commits":39,"total_committers":15,"mean_commits":2.6,"dds":0.6923076923076923,"last_synced_commit":"3ad81718fbada5dde0d66ca269219d8fdb81262c"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudposse%2Fterraform-terraform-label","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudposse%2Fterraform-terraform-label/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudposse%2Fterraform-terraform-label/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudposse%2Fterraform-terraform-label/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudposse","download_url":"https://codeload.github.com/cloudposse/terraform-terraform-label/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247186239,"owners_count":20898121,"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":["hcl2","label","naming-convention","terraform","terraform-module"],"created_at":"2024-09-24T13:15:45.546Z","updated_at":"2025-04-04T14:04:51.299Z","avatar_url":"https://github.com/cloudposse.png","language":"HCL","funding_links":["https://github.com/sponsors/cloudposse"],"categories":[],"sub_categories":[],"readme":"\n\n\u003c!-- markdownlint-disable --\u003e\n# (deprecated) terraform-terraform-label\u003cimg src=\"https://img.shields.io/badge/lifecycle-deprecated-critical?style=for-the-badge\" alt=\"Deprecated\"/\u003e\u003ca href=\"https://github.com/cloudposse/terraform-terraform-label/releases/latest\"\u003e\u003cimg src=\"https://img.shields.io/github/release/cloudposse/terraform-terraform-label.svg?style=for-the-badge\" alt=\"Latest Release\"/\u003e\u003c/a\u003e\u003ca href=\"https://github.com/cloudposse/terraform-terraform-label/commits\"\u003e\u003cimg src=\"https://img.shields.io/github/last-commit/cloudposse/terraform-terraform-label.svg?style=for-the-badge\" alt=\"Last Updated\"/\u003e\u003c/a\u003e\u003ca href=\"https://slack.cloudposse.com\"\u003e\u003cimg src=\"https://slack.cloudposse.com/for-the-badge.svg\" alt=\"Slack Community\"/\u003e\u003c/a\u003e\u003c/p\u003e\n\u003c!-- markdownlint-restore --\u003e\n\n\u003c!--\n\n\n\n\n  ** DO NOT EDIT THIS FILE\n  **\n  ** This file was automatically generated by the `cloudposse/build-harness`.\n  ** 1) Make all changes to `README.yaml`\n  ** 2) Run `make init` (you only need to do this once)\n  ** 3) Run`make readme` to rebuild this file.\n  **\n  ** (We maintain HUNDREDS of open source projects. This is how we maintain our sanity.)\n  **\n\n\n\n\n\n--\u003e\n\n## Deprecated\n\nThis module was an experimental fork and is now obsolete and will not be maintained.\nAny projects using `terraform-terraform-label` are encouraged to switch to using\n[terraform-null-label](https://github.com/cloudposse/terraform-null-label),\nwhich is actively maintained and used by all current Cloud Posse Terraform modules.\n\nThis module was a fork of [terraform-null-label](https://github.com/cloudposse/terraform-null-label), made\nat a time when that project was using the Terraform `null` provider (hence the \"null\" in the name), in order\nto remove the `null` provider dependency. This was accomplished by removing outputs that required the `null`\nprovider.\n\nWith the features that became available in Terraform 0.12, the `terraform-null-label` project was able\nto retain all of its features and also\n[remove the `null` provider](https://github.com/cloudposse/terraform-null-label/commit/d6d24b80d687e76e029f39f444d0163b42c5d5e0),\nremoving any incentive to further develop `terraform-terraform-label`.\n\nWith the key distinguishing feature of `terraform-terraform-label` no longer being a distinguishing feature,\nthis module was no longer necessary, and all focus returned to maintaining and enhancing `terraform-null-label`,\nwhich now far surpasses this module in functionality.\n\nWe literally have \u003ca href=\"https://cpco.io/terraform-modules?utm_source=github\u0026utm_medium=readme\u0026utm_campaign=cloudposse/terraform-terraform-label\u0026utm_content=terraform_modules\"\u003e*hundreds of other terraform modules*\u003c/a\u003e that are Open Source and well-maintained. Check them out!\n\n\n### Historical Description\n\nTerraform module designed to generate consistent label names and tags for resources. Use `terraform-terraform-label` to implement a strict naming convention.\n\n\n#### `terraform-terraform-label` is a fork of [terraform-null-label](https://github.com/cloudposse/terraform-null-label) which uses only the core Terraform provider.\n\nA label follows the following convention: `{namespace}-{stage}-{name}-{attributes}`. The delimiter (e.g. `-`) is interchangeable.\n\nIt's recommended to use one `terraform-terraform-label` module for every unique resource of a given resource type.\nFor example, if you have 10 instances, there should be 10 different labels.\nHowever, if you have multiple different kinds of resources (e.g. instances, security groups, file systems, and elastic IPs), then they can all share the same label assuming they are logically related.\n\nAll [Cloud Posse modules](https://github.com/cloudposse?utf8=%E2%9C%93\u0026q=terraform-\u0026type=\u0026language=) use\nthe related [terraform-null-label](https://github.com/cloudposse/terraform-null-label) module to ensure resources can be instantiated multiple times within an account and without conflict.\n\n**NOTE:** The second `terraform` word in `terraform-terraform-label` refers to the primary Terraform provider used in this module.\n\n\n\u003e [!TIP]\n\u003e #### 👽 Use Atmos with Terraform\n\u003e Cloud Posse uses [`atmos`](https://atmos.tools) to easily orchestrate multiple environments using Terraform. \u003cbr/\u003e\n\u003e Works with [Github Actions](https://atmos.tools/integrations/github-actions/), [Atlantis](https://atmos.tools/integrations/atlantis), or [Spacelift](https://atmos.tools/integrations/spacelift).\n\u003e\n\u003e \u003cdetails\u003e\n\u003e \u003csummary\u003e\u003cstrong\u003eWatch demo of using Atmos with Terraform\u003c/strong\u003e\u003c/summary\u003e\n\u003e \u003cimg src=\"https://github.com/cloudposse/atmos/blob/master/docs/demo.gif?raw=true\"/\u003e\u003cbr/\u003e\n\u003e \u003ci\u003eExample of running \u003ca href=\"https://atmos.tools\"\u003e\u003ccode\u003eatmos\u003c/code\u003e\u003c/a\u003e to manage infrastructure from our \u003ca href=\"https://atmos.tools/quick-start/\"\u003eQuick Start\u003c/a\u003e tutorial.\u003c/i\u003e\n\u003e \u003c/detalis\u003e\n\n\n\n\n\n## Usage\n\n### Simple Example\n\nInclude this repository as a module in your existing terraform code:\n\n```hcl\nmodule \"eg_prod_bastion_label\" {\n  source = \"cloudposse/label/terraform\"\n  # Cloud Posse recommends pinning every module to a specific version\n  # version = \"x.x.x\"\n  namespace  = \"eg\"\n  stage      = \"prod\"\n  name       = \"bastion\"\n  attributes = [\"public\"]\n  delimiter  = \"-\"\n\n  tags = {\n    \"BusinessUnit\" = \"XYZ\",\n    \"Snapshot\"     = \"true\"\n  }\n}\n```\n\nThis will create an `id` with the value of `eg-prod-bastion-public`.\n\nNow reference the label when creating an instance (for example):\n\n```hcl\nresource \"aws_instance\" \"eg_prod_bastion_public\" {\n  instance_type = \"t1.micro\"\n  tags          = module.eg_prod_bastion_label.tags\n}\n```\n\nOr define a security group:\n\n```hcl\nresource \"aws_security_group\" \"eg_prod_bastion_public\" {\n  vpc_id = var.vpc_id\n  name   = module.eg_prod_bastion_label.id\n  tags   = module.eg_prod_bastion_label.tags\n  egress {\n    from_port   = 0\n    to_port     = 0\n    protocol    = \"-1\"\n    cidr_blocks = [\"0.0.0.0/0\"]\n  }\n}\n```\n\n\n### Advanced Example\n\nHere is a more complex example with two instances using two different labels. Note how efficiently the tags are defined for both the instance and the security group.\n\n```hcl\nmodule \"eg_prod_bastion_abc_label\" {\n  source = \"cloudposse/label/terraform\"\n  # Cloud Posse recommends pinning every module to a specific version\n  # version = \"x.x.x\"\n  namespace  = \"eg\"\n  stage      = \"prod\"\n  name       = \"bastion\"\n  attributes = [\"abc\"]\n  delimiter  = \"-\"\n\n  tags = {\n    \"BusinessUnit\" = \"ABC\"\n  }\n}\n\nresource \"aws_security_group\" \"eg_prod_bastion_abc\" {\n  name = module.eg_prod_bastion_abc_label.id\n  tags = module.eg_prod_bastion_abc_label.tags\n  ingress {\n    from_port   = 22\n    to_port     = 22\n    protocol    = \"tcp\"\n    cidr_blocks = [\"0.0.0.0/0\"]\n  }\n}\n\nresource \"aws_instance\" \"eg_prod_bastion_abc\" {\n  instance_type          = \"t1.micro\"\n  tags                   = module.eg_prod_bastion_abc_label.tags\n  vpc_security_group_ids = [aws_security_group.eg_prod_bastion_abc.id]\n}\n\nmodule \"eg_prod_bastion_xyz_label\" {\n  source = \"cloudposse/label/terraform\"\n  # Cloud Posse recommends pinning every module to a specific version\n  # version = \"x.x.x\"\n  namespace  = \"eg\"\n  stage      = \"prod\"\n  name       = \"bastion\"\n  attributes = [\"xyz\"]\n  delimiter  = \"-\"\n\n  tags = {\n    \"BusinessUnit\" = \"XYZ\"\n  }\n}\n\nresource \"aws_security_group\" \"eg_prod_bastion_xyz\" {\n  name = module.eg_prod_bastion_xyz_label.id\n  tags = module.eg_prod_bastion_xyz_label.tags\n  ingress {\n    from_port   = 22\n    to_port     = 22\n    protocol    = \"tcp\"\n    cidr_blocks = [\"0.0.0.0/0\"]\n  }\n}\n\nresource \"aws_instance\" \"eg_prod_bastion_xyz\" {\n  instance_type          = \"t1.micro\"\n  tags                   = module.eg_prod_bastion_xyz_label.tags\n  vpc_security_group_ids = [aws_security_group.eg_prod_bastion_xyz.id]\n}\n```\n\n\u003e [!IMPORTANT]\n\u003e In Cloud Posse's examples, we avoid pinning modules to specific versions to prevent discrepancies between the documentation\n\u003e and the latest released versions. However, for your own projects, we strongly advise pinning each module to the exact version\n\u003e you're using. This practice ensures the stability of your infrastructure. Additionally, we recommend implementing a systematic\n\u003e approach for updating versions to avoid unexpected changes.\n\n\n\n\n\n\n\n## License\n\n\u003ca href=\"https://opensource.org/licenses/Apache-2.0\"\u003e\u003cimg src=\"https://img.shields.io/badge/License-Apache%202.0-blue.svg?style=for-the-badge\" alt=\"License\"\u003e\u003c/a\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003ePreamble to the Apache License, Version 2.0\u003c/summary\u003e\n\u003cbr/\u003e\n\u003cbr/\u003e\n\nComplete license is available in the [`LICENSE`](LICENSE) file.\n\n```text\nLicensed to the Apache Software Foundation (ASF) under one\nor more contributor license agreements.  See the NOTICE file\ndistributed with this work for additional information\nregarding copyright ownership.  The ASF licenses this file\nto you under the Apache License, Version 2.0 (the\n\"License\"); you may not use this file except in compliance\nwith the License.  You may obtain a copy of the License at\n\n  https://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing,\nsoftware distributed under the License is distributed on an\n\"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\nKIND, either express or implied.  See the License for the\nspecific language governing permissions and limitations\nunder the License.\n```\n\u003c/details\u003e\n\n## Trademarks\n\nAll other trademarks referenced herein are the property of their respective owners.\n\n\n---\nCopyright © 2017-2024 [Cloud Posse, LLC](https://cpco.io/copyright)\n\n\n\u003ca href=\"https://cloudposse.com/readme/footer/link?utm_source=github\u0026utm_medium=readme\u0026utm_campaign=cloudposse/terraform-terraform-label\u0026utm_content=readme_footer_link\"\u003e\u003cimg alt=\"README footer\" src=\"https://cloudposse.com/readme/footer/img\"/\u003e\u003c/a\u003e\n\n\u003cimg alt=\"Beacon\" width=\"0\" src=\"https://ga-beacon.cloudposse.com/UA-76589703-4/cloudposse/terraform-terraform-label?pixel\u0026cs=github\u0026cm=readme\u0026an=terraform-terraform-label\"/\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudposse%2Fterraform-terraform-label","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudposse%2Fterraform-terraform-label","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudposse%2Fterraform-terraform-label/lists"}