Skip to main content
terraform azurerm caf naming
  1. projects/

terraform azurerm caf naming

Table of Contents
Release

My caf-naming terraform module for azurerm provides a nice consistent way to create names for Azure resources. You provide the naming scheme you want (or use the default one), provide the required variables and then you can easily reference names through the outputs of the module.

Check it out on the terraform registry.

Default naming convention: {prefix}-{company_abbreviation}-{project}-{environment}-{instance_number}

The prefix of a resource is always included. To get the prefixes, this module uses my resource prefix module to get the correct prefixes.

See caf naming components for more info.

Usage
#

To use the default naming convention, copy paste the following into your terraform config. After that, run terraform init

module "caf-naming" {
  source  = "nietarne/caf-naming/azurerm"

  company_abbreviation = "comp"
  project              = "blogsite"
  environment          = "dev"
}

If you want to check the generated name of a resource:

output "resourcegroupname" {
    value = module.caf-naming.resource_group[0]
}
Warning! The module outputs lists of names, this way you can generate multiple names (think of instance numbers)