Skip to content

Latest commit

 

History

History
354 lines (317 loc) · 12.4 KB

README.md

File metadata and controls

354 lines (317 loc) · 12.4 KB

Azure Naming

This module helps you to keep consistency on your resources names for Terraform The goal of this module it is that for each resource that requires a name in Terraform you would be easily able to compose this name using this module and this will keep the consistency in your repositories.

Usage

For every resource in terraform_azurerm just remove the azurerm part of the module and use the name property of this output.

example for azurerm_resource_group you can use :

module "naming" {
  source  = "Azure/naming/azurerm"
  suffix = [ "test" ]
}
resource "azurerm_resource_group" "example" {
  name     = module.naming.resource_group.name
  location = "West Europe"
}

if you want this to be unique for this module and not shared with other instances of this module you can use name_unique

module "naming" {
  source  = "Azure/naming/azurerm"
  suffix = [ "test" ]
}
resource "azurerm_resource_group" "example" {
  name     = module.naming.resource_group.name_unique
  location = "West Europe"
}

Other advanced usages will be explained in the Advanced usage part of this docs.

Internals

Prerequisites and setup

  • Install tflint as suitable for your OS.

  • Run make install in the root directory of the repo.

Modifying resources

The resources are automatically generated using go to change the generation please change the file on the templates folder. To add a new resource, including its definition in the file resourceDefinition.json, and it will be automatically generated when main.go is run.

Current implementation

You can find a list bellow of all the resources that are currently implemented. To get a list of the ones that are missing implementation you can check at Missing resources the resources that have no documentation about their limitation on naming currently on Microsoft docs are on the Not defined list.

Advanced usage

Output

Each one of the resources emits the name of the resource and other properties:

Property Type Description
name string name of the resource including respective suffixes and prefixes applied
name_unique string same as the name but with random chars added for uniqueness
dashes bool if these resources support dashes
slug string letters to identify this resource among others
min_length integer Minimum length required for this resource name
max_length integer Maximum length allowed for this resource name
scope string scope which this name needs to be unique, such as resourcegroup or global
regex string Terraform compatible version of the regex

Example Output

Every resource will have an output with the following format:

postgresql_server = {
      name        = "pre-fix-psql-su-fix"
      name_unique = "pre-fix-psql-su-fix-asdfg"
      dashes      = true
      slug        = "psql"
      min_length  = 3
      max_length  = 63
      scope       = "global"
      regex       = "^[a-z0-9][a-zA-Z0-9-]+[a-z0-9]$"
    }

Requirements

Name Version
random ~> 2.2

Providers

Name Version
random ~> 2.2

Inputs

Name Description Type Default Required
prefix It is not recommended that you use prefix by azure you should be using a suffix for your resources. list(string) [] no
suffix It is recommended that you specify a suffix for consistency. please use only lowercase characters when possible list(string) [] no
unique-include-numbers If you want to include numbers in the unique generation bool true no
unique-length Max length of the uniqueness suffix to be added number 4 no
unique-seed Custom value for the random characters to be used string "" no

Outputs

Name Description
analysis_services_server n/a
api_management n/a
app_configuration n/a
app_service n/a
app_service_plan n/a
application_insights n/a
application_gateway n/a
application_security_group n/a
automation_account n/a
automation_certificate n/a
automation_credential n/a
automation_runbook n/a
automation_schedule n/a
automation_variable n/a
availability_set n/a
bastion_host n/a
batch_account n/a
batch_application n/a
batch_certificate n/a
batch_pool n/a
bot_channel_email n/a
bot_channel_directline n/a
bot_channel_ms_teams n/a
bot_channel_slack n/a
bot_channels_registration n/a
bot_connection n/a
bot_web_app n/a
cdn_endpoint n/a
cdn_profile n/a
cognitive_account n/a
container_group n/a
container_registry n/a
container_registry_webhook n/a
cosmosdb_account n/a
custom_provider n/a
dashboard n/a
data_factory n/a
data_factory_dataset_mysql n/a
data_factory_dataset_postgresql n/a
data_factory_dataset_sql_server_table n/a
data_factory_integration_runtime_managed n/a
data_factory_linked_service_data_lake_storage_gen2 n/a
data_factory_linked_service_key_vault n/a
data_factory_linked_service_mysql n/a
data_factory_linked_service_postgresql n/a
data_factory_linked_service_sql_server n/a
data_factory_pipeline n/a
data_factory_trigger_schedule n/a
data_lake_analytics_account n/a
data_lake_analytics_firewall_rule n/a
data_lake_store n/a
data_lake_store_firewall_rule n/a
database_migration_project n/a
database_migration_service n/a
databricks_cluster n/a
databricks_high_concurrency_cluster n/a
databricks_standard_cluster n/a
databricks_workspace n/a
dev_test_lab n/a
dev_test_linux_virtual_machine n/a
dev_test_windows_virtual_machine n/a
disk_encryption_set n/a
dns_a_record n/a
dns_aaaa_record n/a
dns_caa_record n/a
dns_cname_record n/a
dns_mx_record n/a
dns_ns_record n/a
dns_ptr_record n/a
dns_txt_record n/a
dns_zone n/a
eventgrid_domain n/a
eventgrid_domain_topic n/a
eventgrid_event_subscription n/a
eventgrid_topic n/a
eventhub n/a
eventhub_authorization_rule n/a
eventhub_consumer_group n/a
eventhub_namespace n/a
eventhub_namespace_authorization_rule n/a
eventhub_namespace_disaster_recovery_config n/a
express_route_circuit n/a
express_route_gateway n/a
firewall n/a
firewall_application_rule_collection n/a
firewall_ip_configuration n/a
firewall_nat_rule_collection n/a
firewall_network_rule_collection n/a
frontdoor n/a
frontdoor_firewall_policy n/a
function_app n/a
hdinsight_hadoop_cluster n/a
hdinsight_hbase_cluster n/a
hdinsight_interactive_query_cluster n/a
hdinsight_kafka_cluster n/a
hdinsight_ml_services_cluster n/a
hdinsight_rserver_cluster n/a
hdinsight_spark_cluster n/a
hdinsight_storm_cluster n/a
image n/a
iotcentral_application n/a
iothub n/a
iothub_consumer_group n/a
iothub_dps n/a
iothub_dps_certificate n/a
key_vault n/a
key_vault_certificate n/a
key_vault_key n/a
key_vault_secret n/a
kubernetes_cluster n/a
kusto_cluster n/a
kusto_database n/a
kusto_eventhub_data_connection n/a
lb n/a
lb_nat_rule n/a
linux_virtual_machine n/a
linux_virtual_machine_scale_set n/a
local_network_gateway n/a
log_analytics_workspace n/a
machine_learning_workspace n/a
managed_disk n/a
maps_account n/a
mariadb_database n/a
mariadb_firewall_rule n/a
mariadb_server n/a
mariadb_virtual_network_rule n/a
mssql_database n/a
mssql_elasticpool n/a
mssql_server n/a
mysql_database n/a
mysql_firewall_rule n/a
mysql_server n/a
mysql_virtual_network_rule n/a
network_ddos_protection_plan n/a
network_interface n/a
network_security_group n/a
network_security_group_rule n/a
network_security_rule n/a
network_watcher n/a
notification_hub n/a
notification_hub_authorization_rule n/a
notification_hub_namespace n/a
point_to_site_vpn_gateway n/a
postgresql_database n/a
postgresql_firewall_rule n/a
postgresql_server n/a
postgresql_virtual_network_rule n/a
powerbi_embedded n/a
private_dns_a_record n/a
private_dns_aaaa_record n/a
private_dns_cname_record n/a
private_dns_mx_record n/a
private_dns_ptr_record n/a
private_dns_srv_record n/a
private_dns_txt_record n/a
private_dns_zone n/a
private_dns_zone_group n/a
private_endpoint n/a
private_link_service n/a
private_service_connection n/a
proximity_placement_group n/a
public_ip n/a
public_ip_prefix n/a
redis_cache n/a
redis_firewall_rule n/a
relay_hybrid_connection n/a
relay_namespace n/a
resource_group n/a
role_assignment n/a
role_definition n/a
route n/a
route_table n/a
service_fabric_cluster n/a
servicebus_namespace n/a
servicebus_namespace_authorization_rule n/a
servicebus_queue n/a
servicebus_queue_authorization_rule n/a
servicebus_subscription n/a
servicebus_subscription_rule n/a
servicebus_topic n/a
servicebus_topic_authorization_rule n/a
shared_image n/a
shared_image_gallery n/a
signalr_service n/a
snapshots n/a
sql_elasticpool n/a
sql_failover_group n/a
sql_firewall_rule n/a
sql_server n/a
storage_account n/a
storage_blob n/a
storage_container n/a
storage_data_lake_gen2_filesystem n/a
storage_queue n/a
storage_share n/a
storage_share_directory n/a
storage_table n/a
stream_analytics_function_javascript_udf n/a
stream_analytics_job n/a
stream_analytics_output_blob n/a
stream_analytics_output_eventhub n/a
stream_analytics_output_mssql n/a
stream_analytics_output_servicebus_queue n/a
stream_analytics_output_servicebus_topic n/a
stream_analytics_reference_input_blob n/a
stream_analytics_stream_input_blob n/a
stream_analytics_stream_input_eventhub n/a
stream_analytics_stream_input_iothub n/a
subnet n/a
template_deployment n/a
traffic_manager_profile n/a
unique-seed n/a
user_assigned_identity n/a
validation n/a
virtual_machine n/a
virtual_machine_extension n/a
virtual_machine_scale_set n/a
virtual_machine_scale_set_extension n/a
virtual_network n/a
virtual_network_gateway n/a
virtual_network_peering n/a
virtual_wan n/a
windows_virtual_machine n/a
windows_virtual_machine_scale_set n/a

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.