Resource Name Mapper#
There are two modules:
naming
batch
The root module#
The root module only demonstrates the use of naming
and batch
. These examples are in main.tf.
naming#
The module naming
accepts a base_name
and resource_type
input.
base_name
can be anystring
.resource_type
is astring
and must be one ofvirtual_machine
,key_vault
, orstorage_account
.
An output, resource_name
is returned. Its value is the reformatted base_name
based on its resource_type
.
The following transformations are applied to base_name
based on resource_type
:
virtual_machine
prependsvm-
and appends-00
.base_name
is limited to 15 characters.key_vault
prependskv-
.base_name
characters are lower-cased.storage_account
prependssa
.base_name
removes hyphens, and is lower-cased.
Here are examples of this module’s output for the resource_name
.
|
|
|
---|---|---|
|
|
|
|
|
|
|
|
|
batch#
The module batch
accepts an input resources
that is a map of { "base_name" = "resource_type" }
. This allows the creation of several resource_name``s without invoking the ``naming
module directly.
In the map, the key is base_name
and the value is resource_type
. The inputs follow the same rules as the naming
module.
base_name
can be anystring
.resource_type
is astring
and must be one ofvirtual_machine
,key_vault
, orstorage_account
.
An output, resource_names
is returned. Its value is a map of { "base_name" = "resource_name" }
where resource_name
is the transformed base_name
value from the naming
module.
Here are examples of this module’s output for the resource_names
.
|
|
---|---|
|
|
|
|
|
|
Tests#
Run terraform test
to execute automated tests for these modules.