https://github.com/devops-ia/terraform-global-naming
Terraform module for global naming conventions
https://github.com/devops-ia/terraform-global-naming
cloud naming naming-conventions naming-pattern terraform terraform-module
Last synced: 4 months ago
JSON representation
Terraform module for global naming conventions
- Host: GitHub
- URL: https://github.com/devops-ia/terraform-global-naming
- Owner: devops-ia
- License: mit
- Created: 2024-08-06T13:16:25.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2026-01-31T11:06:11.000Z (4 months ago)
- Last Synced: 2026-01-31T22:53:15.725Z (4 months ago)
- Topics: cloud, naming, naming-conventions, naming-pattern, terraform, terraform-module
- Language: HCL
- Homepage: https://registry.terraform.io/modules/devops-ia/naming/global/latest
- Size: 56.6 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Terraform global naming
This module helps you to keep consistency on your resources names for Terraform. For each resource that requires a name you can compose it using this module, keeping naming conventions consistent across your repositories.
## Usage
```hcl
module "aws_bucket_name" {
source = "devops-ia/naming/global"
project = "myproject"
environment = "dev"
resource = "s3"
description = "dummy"
}
output "aws_bucket_name" {
value = module.aws_bucket_name.name
}
resource "aws_s3_bucket" "dummy" {
bucket = module.aws_bucket_name.name
...
}
```
Outputs:
```
Changes to Outputs:
+ aws_bucket_name = "myproject-dev-s3-dummy"
```
The name is constructed by joining the non-empty parts (`prefix`, `project`, `environment`, `resource`, `location`, `description`, `suffix`) with the configured `delimiter`. Empty values are automatically omitted so there are no extraneous delimiters.
Length validation happens at **plan time** — if the resulting name exceeds `limits` (default 25), Terraform will fail with a clear error message showing the actual name and length.
## Terraform Docs
## Requirements
| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 1.3.0 |
## Providers
No providers.
## Modules
No modules.
## Resources
No resources.
## Inputs
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [delimiter](#input\_delimiter) | Character used to join name parts (e.g. '-', '\_', ''). | `string` | `"-"` | no |
| [description](#input\_description) | Optional description to add context to the resource name. | `string` | `""` | no |
| [environment](#input\_environment) | Environment name (e.g. dev, staging, prod). | `string` | n/a | yes |
| [limits](#input\_limits) | Maximum allowed character length for the constructed resource name. | `number` | `25` | no |
| [location](#input\_location) | Optional location or region appended to the resource name. | `string` | `""` | no |
| [prefix](#input\_prefix) | Optional prefix prepended to the resource name. | `string` | `""` | no |
| [project](#input\_project) | Project name used as a component of the resource name. | `string` | n/a | yes |
| [resource](#input\_resource) | Resource type identifier (e.g. vm, s3, rg). | `string` | n/a | yes |
| [suffix](#input\_suffix) | Optional suffix appended at the end of the resource name. | `string` | `""` | no |
## Outputs
| Name | Description |
|------|-------------|
| [name](#output\_name) | The constructed resource name. |
| [total\_length](#output\_total\_length) | Total character length of the constructed resource name. |
## Authors
Module is maintained by [DevOps IA](https://github.com/devops-ia) with help from [these awesome contributors](https://github.com/devops-ia/terraform-global-naming/graphs/contributors).