{"id":19129359,"url":"https://github.com/launchbynttdata/tf-launch-module_library-resource_name","last_synced_at":"2026-04-02T23:52:08.500Z","repository":{"id":231028409,"uuid":"776072315","full_name":"launchbynttdata/tf-launch-module_library-resource_name","owner":"launchbynttdata","description":"Terraform module to produce structured resource names","archived":false,"fork":false,"pushed_at":"2024-11-01T13:14:16.000Z","size":306,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-01-03T10:46:06.720Z","etag":null,"topics":["library","terraform"],"latest_commit_sha":null,"homepage":null,"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/launchbynttdata.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":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-22T16:15:18.000Z","updated_at":"2024-11-01T13:13:58.000Z","dependencies_parsed_at":"2024-04-02T04:25:59.241Z","dependency_job_id":"004f1cb6-2156-498d-9d50-a37c59dda950","html_url":"https://github.com/launchbynttdata/tf-launch-module_library-resource_name","commit_stats":null,"previous_names":["launchbynttdata/tf-launch-module_library-resource_name"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/launchbynttdata%2Ftf-launch-module_library-resource_name","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/launchbynttdata%2Ftf-launch-module_library-resource_name/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/launchbynttdata%2Ftf-launch-module_library-resource_name/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/launchbynttdata%2Ftf-launch-module_library-resource_name/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/launchbynttdata","download_url":"https://codeload.github.com/launchbynttdata/tf-launch-module_library-resource_name/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240199257,"owners_count":19763827,"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":["library","terraform"],"created_at":"2024-11-09T06:07:16.877Z","updated_at":"2026-04-02T23:52:08.494Z","avatar_url":"https://github.com/launchbynttdata.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tf-launch-module_library-resource_name\n\n[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![License: CC BY-NC-ND 4.0](https://img.shields.io/badge/License-CC_BY--NC--ND_4.0-lightgrey.svg)](https://creativecommons.org/licenses/by-nc-nd/4.0/)\n\n## Overview\n\nThis module generates the name of cloud resources in different formats as specified below. For the product_family `demo_org`,\nproduct_service `test_backend`, environment `dev` and cloud resource `acr` with a default maximum_length `60`\n```\n# Outputs\ncamel_case = \"Demo_orgTest_backendUseast2Dev000Acr000\"\ncamel_case_with_separator = \"Demo_org-Test_backend-Useast2-Dev-000-Acr-000\"\ncamel_case_without_any_separators = \"DemoorgTestbackendUseast2Dev000Acr000\"\ndns_compliant_minimal = \"demo-org-test-backend-dev-000-acr\"\ndns_compliant_minimal_random_suffix = \"demo-org-test-backend-9349499394\"\nlower_case = \"demo_orgtest_backenduseast2dev000acr000\"\nlower_case_with_separator = \"demo_org-test_backend-useast2-dev-000-acr-000\"\nlower_case_without_any_separators = \"demoorgtestbackenduseast2dev000acr000\"\nminimal = \"demo_org-test_backend-dev-000-acr\"\nminimal_random_suffix = \"demo_org-test_backend-9349499394\"\nrecommended_per_length_restriction = \"demo_org-test_backend-useast2-dev-000-acr-000\"\nstandard = \"demo_org-test_backend-useast2-dev-000-acr-000\"\nupper_case = \"DEMO_ORGTEST_BACKENDUSEAST2DEV000ACR000\"\nupper_case_with_separator = \"DEMO_ORG-TEST_BACKEND-USEAST2-DEV-000-ACR-000\"\nupper_case_without_any_separators = \"DEMOORGTESTBACKENDUSEAST2DEV000ACR000\"\nrandom_integer = 9349499394\n```\n\nThe same output with a maximum_length of `32` generates below.\n\nObserve the value of `recommended_per_length_restriction`\n\n```\ncamel_case = \"DemoBackendEus2Dev001Acr000\"\ncamel_case_with_separator = \"Demo-Backend-Eus2-Dev-001-Acr-000\"\ncamel_case_without_any_separators = \"DemoBackendEus2Dev001Acr000\"\ndns_compliant_minimal = \"demo-backend-dev-001-acr\"\ndns_compliant_minimal_random_suffix = \"demo-backend-9003923140\"\ndns_compliant_standard = \"demo-backend-eus2-dev-001-acr-000\"\nlower_case = \"demobackendeus2dev001acr000\"\nlower_case_with_separator = \"demo-backend-eus2-dev-001-acr-000\"\nlower_case_without_any_separators = \"demobackendeus2dev001acr000\"\nminimal = \"demo-backend-dev-001-acr\"\nminimal_random_suffix = \"demo-backend-9003923140\"\nminimal_random_suffix_without_any_separators = \"demobackend9003923140\"\nrecommended_per_length_restriction = \"demobackendeus2dev001acr000\"\nstandard = \"demo-backend-eus2-dev-001-acr-000\"\nupper_case = \"DEMOBACKENDEUS2DEV001ACR000\"\nupper_case_with_separator = \"DEMO-BACKEND-EUS2-DEV-001-ACR-000\"\nupper_case_without_any_separators = \"DEMOBACKENDEUS2DEV001ACR000\"\nrandom_integer = 9003923140\n```\n\n## Pre-Commit hooks\n[.pre-commit-config.yaml](.pre-commit-config.yaml) file defines certain `pre-commit` hooks that are relevant to terraform, golang and common linting tasks. There are no custom hooks added.\n\n`commitlint` hook enforces commit message in certain format. The commit contains the following structural elements, to communicate intent to the consumers of your commit messages:\n\n- **fix**: a commit of the type `fix` patches a bug in your codebase (this correlates with PATCH in Semantic Versioning).\n- **feat**: a commit of the type `feat` introduces a new feature to the codebase (this correlates with MINOR in Semantic Versioning).\n- **BREAKING CHANGE**: a commit that has a footer `BREAKING CHANGE:`, or appends a `!` after the type/scope, introduces a breaking API change (correlating with MAJOR in Semantic Versioning). A BREAKING CHANGE can be part of commits of any type.\nfooters other than BREAKING CHANGE: \u003cdescription\u003e may be provided and follow a convention similar to git trailer format.\n- **build**: a commit of the type `build` adds changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)\n- **chore**: a commit of the type `chore` adds changes that don't modify src or test files\n- **ci**: a commit of the type `ci` adds changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)\n- **docs**: a commit of the type `docs` adds documentation only changes\n- **perf**: a commit of the type `perf` adds code change that improves performance\n- **refactor**: a commit of the type `refactor` adds code change that neither fixes a bug nor adds a feature\n- **revert**: a commit of the type `revert` reverts a previous commit\n- **style**: a commit of the type `style` adds code changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)\n- **test**: a commit of the type `test` adds missing tests or correcting existing tests\n\nBase configuration used for this project is [commitlint-config-conventional (based on the Angular convention)](https://github.com/conventional-changelog/commitlint/tree/master/@commitlint/config-conventional#type-enum)\n\nIf you are a developer using vscode, [this](https://marketplace.visualstudio.com/items?itemName=joshbolduc.commitlint) plugin may be helpful.\n\n`detect-secrets-hook` prevents new secrets from being introduced into the baseline. TODO: INSERT DOC LINK ABOUT HOOKS\n\nIn order for `pre-commit` hooks to work properly\n- You need to have the pre-commit package manager installed. [Here](https://pre-commit.com/#install) are the installation instructions.\n- `pre-commit` would install all the hooks when commit message is added by default except for `commitlint` hook. `commitlint` hook would need to be installed manually using the command below\n```\npre-commit install --hook-type commit-msg\n```\n\n## To test the resource group module locally\n\n1. For development/enhancements to this module locally, you'll need to install all of its components. This is controlled by the `configure` target in the project's [`Makefile`](./Makefile). Before you can run `configure`, familiarize yourself with the variables in the `Makefile` and ensure they're pointing to the right places.\n\n```\nmake configure\n```\n\nThis adds in several files and directories that are ignored by `git`. They expose many new Make targets.\n\n2. The first target you care about is `env`. This is the common interface for setting up environment variables. The values of the environment variables will be used to authenticate with cloud provider from local development workstation.\n\n`make configure` command will bring down `azure_env.sh` file on local workstation. Devloper would need to modify this file, replace the environment variable values with relevant values.\n\nThese environment variables are used by `terratest` integration suit.\n\nService principle used for authentication(value of ARM_CLIENT_ID) should have below privileges on resource group within the subscription.\n\n```\n\"Microsoft.Resources/subscriptions/resourceGroups/write\"\n\"Microsoft.Resources/subscriptions/resourceGroups/read\"\n\"Microsoft.Resources/subscriptions/resourceGroups/delete\"\n```\n\nThen run this make target to set the environment variables on developer workstation.\n\n```\nmake env\n```\n\n3. The first target you care about is `check`.\n\n**Pre-requisites**\nBefore running this target it is important to ensure that, developer has created files mentioned below on local workstation under root directory of git repository that contains code for primitives/segments. Note that these files are `azure` specific. If primitive/segment under development uses any other cloud provider than azure, this section may not be relevant.\n- A file named `provider.tf` with contents below\n\n```\nprovider \"azurerm\" {\n  features {}\n}\n```\n- A file named `terraform.tfvars` which contains key value pair of variables used.\n\nNote that since these files are added in `gitgnore` they would not be checked in into primitive/segment's git repo.\n\nAfter creating these files, for running tests associated with the primitive/segment, run\n\n```\nmake check\n```\n\nIf `make check` target is successful, developer is good to commit the code to primitive/segment's git repo.\n\n`make check` target\n- runs `terraform commands` to `lint`,`validate` and `plan` terraform code.\n- runs `conftests`. `conftests` make sure `policy` checks are successful.\n- runs `terratest`. This is integration test suit.\n- runs `opa` tests\n\u003c!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --\u003e\n## Requirements\n\n| Name | Version |\n|------|---------|\n| \u003ca name=\"requirement_terraform\"\u003e\u003c/a\u003e [terraform](#requirement\\_terraform) | ~\u003e 1.0 |\n| \u003ca name=\"requirement_random\"\u003e\u003c/a\u003e [random](#requirement\\_random) | \u003e= 3.5 |\n\n## Providers\n\n| Name | Version |\n|------|---------|\n| \u003ca name=\"provider_random\"\u003e\u003c/a\u003e [random](#provider\\_random) | 3.6.3 |\n\n## Modules\n\nNo modules.\n\n## Resources\n\n| Name | Type |\n|------|------|\n| [random_integer.random_number](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/integer) | resource |\n\n## Inputs\n\n| Name | Description | Type | Default | Required |\n|------|-------------|------|---------|:--------:|\n| \u003ca name=\"input_logical_product_family\"\u003e\u003c/a\u003e [logical\\_product\\_family](#input\\_logical\\_product\\_family) | (Required) Name of the product family for which the resource is created.\u003cbr\u003e    Example: org\\_name, department\\_name. | `string` | n/a | yes |\n| \u003ca name=\"input_logical_product_service\"\u003e\u003c/a\u003e [logical\\_product\\_service](#input\\_logical\\_product\\_service) | (Required) Name of the product service for which the resource is created.\u003cbr\u003e    For example, backend, frontend, middleware etc. | `string` | n/a | yes |\n| \u003ca name=\"input_region\"\u003e\u003c/a\u003e [region](#input\\_region) | (Required) The location where the resource will be created. Must not have spaces\u003cbr\u003e    For example, us-east-2, useast2, West-US-2 | `string` | n/a | yes |\n| \u003ca name=\"input_class_env\"\u003e\u003c/a\u003e [class\\_env](#input\\_class\\_env) | (Required) Environment where resource is going to be deployed. For example. dev, qa, uat | `string` | n/a | yes |\n| \u003ca name=\"input_instance_env\"\u003e\u003c/a\u003e [instance\\_env](#input\\_instance\\_env) | Number that represents the instance of the environment. | `number` | `0` | no |\n| \u003ca name=\"input_cloud_resource_type\"\u003e\u003c/a\u003e [cloud\\_resource\\_type](#input\\_cloud\\_resource\\_type) | (Required) Abbreviation for the type of resource. For ex. 'rg' for Azure Resource group. | `string` | n/a | yes |\n| \u003ca name=\"input_instance_resource\"\u003e\u003c/a\u003e [instance\\_resource](#input\\_instance\\_resource) | Number that represents the instance of the resource. | `number` | `0` | no |\n| \u003ca name=\"input_maximum_length\"\u003e\u003c/a\u003e [maximum\\_length](#input\\_maximum\\_length) | Number that represents the maximum length the resource name could have. | `number` | `60` | no |\n| \u003ca name=\"input_separator\"\u003e\u003c/a\u003e [separator](#input\\_separator) | Separator to be used in the name | `string` | `\"-\"` | no |\n| \u003ca name=\"input_use_azure_region_abbr\"\u003e\u003c/a\u003e [use\\_azure\\_region\\_abbr](#input\\_use\\_azure\\_region\\_abbr) | Whether to use Azure region abbreviation e.g. eastus -\u003e eus | `bool` | `false` | no |\n\n## Outputs\n\n| Name | Description |\n|------|-------------|\n| \u003ca name=\"output_lower_case\"\u003e\u003c/a\u003e [lower\\_case](#output\\_lower\\_case) | Name of the resource in lower case. |\n| \u003ca name=\"output_lower_case_without_any_separators\"\u003e\u003c/a\u003e [lower\\_case\\_without\\_any\\_separators](#output\\_lower\\_case\\_without\\_any\\_separators) | Name of the resource in lower case without any separators. Will remove any separators present in any fields as well. |\n| \u003ca name=\"output_lower_case_with_separator\"\u003e\u003c/a\u003e [lower\\_case\\_with\\_separator](#output\\_lower\\_case\\_with\\_separator) | Name of the resource with lower case and separator. If separator is not provided by user, then '-' character will be used as a separator. |\n| \u003ca name=\"output_upper_case\"\u003e\u003c/a\u003e [upper\\_case](#output\\_upper\\_case) | Name of the resource in upper case. |\n| \u003ca name=\"output_upper_case_without_any_separators\"\u003e\u003c/a\u003e [upper\\_case\\_without\\_any\\_separators](#output\\_upper\\_case\\_without\\_any\\_separators) | Name of the resource in upper case without any separators. Will remove any separators present in any fields as well. |\n| \u003ca name=\"output_upper_case_with_separator\"\u003e\u003c/a\u003e [upper\\_case\\_with\\_separator](#output\\_upper\\_case\\_with\\_separator) | Name of the resource in upper case and separator. If separator is not provided by user, then '-' character will be used as a separator. |\n| \u003ca name=\"output_standard\"\u003e\u003c/a\u003e [standard](#output\\_standard) | Name of the resource as per pre-determined recommended naming convention that is join each field with the provided separator |\n| \u003ca name=\"output_recommended_per_length_restriction\"\u003e\u003c/a\u003e [recommended\\_per\\_length\\_restriction](#output\\_recommended\\_per\\_length\\_restriction) | Name of the resource that fits the maximum length restriction criteria specified by the user.\u003cbr\u003e    Returns standard else camel\\_case\\_without\\_any\\_separators else minimal\\_without\\_any\\_separators until it\u003cbr\u003e    satisfies the maximum\\_length requirements |\n| \u003ca name=\"output_camel_case\"\u003e\u003c/a\u003e [camel\\_case](#output\\_camel\\_case) | Name of the resource in camel case. |\n| \u003ca name=\"output_camel_case_without_any_separators\"\u003e\u003c/a\u003e [camel\\_case\\_without\\_any\\_separators](#output\\_camel\\_case\\_without\\_any\\_separators) | Name of the resource in camel case. Will remove any separators present in any fields as well. |\n| \u003ca name=\"output_camel_case_with_separator\"\u003e\u003c/a\u003e [camel\\_case\\_with\\_separator](#output\\_camel\\_case\\_with\\_separator) | Name of the resource in camel case and separator. If separator is not provided by user, then '-' character will be used as a separator. |\n| \u003ca name=\"output_minimal\"\u003e\u003c/a\u003e [minimal](#output\\_minimal) | Name of the resource would exclude region, instance\\_resource |\n| \u003ca name=\"output_minimal_random_suffix\"\u003e\u003c/a\u003e [minimal\\_random\\_suffix](#output\\_minimal\\_random\\_suffix) | Name of the resource would exclude region, instance\\_resource and append a random number suffix. This supports max\\_length restriction |\n| \u003ca name=\"output_minimal_random_suffix_without_any_separators\"\u003e\u003c/a\u003e [minimal\\_random\\_suffix\\_without\\_any\\_separators](#output\\_minimal\\_random\\_suffix\\_without\\_any\\_separators) | Name of the resource would exclude region, instance\\_resource and append a random number suffix. This supports max\\_length restriction and will remove any separators present in any fields as well. |\n| \u003ca name=\"output_dns_compliant_minimal\"\u003e\u003c/a\u003e [dns\\_compliant\\_minimal](#output\\_dns\\_compliant\\_minimal) | Name is minimal and DNS complaint, that is it can contain only -. |\n| \u003ca name=\"output_dns_compliant_standard\"\u003e\u003c/a\u003e [dns\\_compliant\\_standard](#output\\_dns\\_compliant\\_standard) | Name is standard and DNS complaint, that is it can contain only -. |\n| \u003ca name=\"output_dns_compliant_minimal_random_suffix\"\u003e\u003c/a\u003e [dns\\_compliant\\_minimal\\_random\\_suffix](#output\\_dns\\_compliant\\_minimal\\_random\\_suffix) | Name is minimal\\_random\\_suffix and DNS complaint, that is it can contain only -. |\n\u003c!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaunchbynttdata%2Ftf-launch-module_library-resource_name","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flaunchbynttdata%2Ftf-launch-module_library-resource_name","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaunchbynttdata%2Ftf-launch-module_library-resource_name/lists"}