When configuring the inputs for the module without reviewing the actual module scripting it can be confusing to some users when trying to set up the configuration for relating between which references are tied to the provisioning resource name and which are related to the reference key for a map object to associate between resources. Additionally looking across the input variables used for the various resources there looks to be inconsistencies between when the name, or just type of resource is being used to indicate a relation for what to lookup or configure.
Example
In the below example is a case where the user might assume that the key for the vpn_sites and the name of the site must match but in execution, only the key needs to be used consistently and the name provisioned does not actually have to match the key.
By changing the name of the virtual_hub_name to instead be virtual_hub_key we can distinguish between these two concepts more clearly and improve the user experience for people using the module.
variable "vpn_sites" {
type = map(object({
name = string
# Key of the virtual hub map to create the vpn site in
virtual_hub_key = string <-- This clarifies that the name is independent of the reference to the provisioning virtual_hub map key
links = list(object({
name = string
bgp = optional(object({
asn = number
peering_address = string
}))
fqdn = optional(string)
ip_address = optional(string)
provider_name = optional(string)
speed_in_mbps = optional(number)
}
))
address_cidrs = optional(list(string))
device_model = optional(string)
device_vendor = optional(string)
o365_policy = optional(object({
traffic_category = object({
allow_endpoint_enabled = optional(bool)
default_endpoint_enabled = optional(bool)
optimize_endpoint_enabled = optional(bool)
})
}))
tags = optional(map(string))
}))
description = "S2S VPN Sites parameter"
default = {}
}
Summary
When configuring the inputs for the module without reviewing the actual module scripting it can be confusing to some users when trying to set up the configuration for relating between which references are tied to the provisioning resource name and which are related to the reference key for a map object to associate between resources. Additionally looking across the input variables used for the various resources there looks to be inconsistencies between when the name, or just type of resource is being used to indicate a relation for what to lookup or configure.
Example
In the below example is a case where the user might assume that the key for the vpn_sites and the name of the site must match but in execution, only the key needs to be used consistently and the name provisioned does not actually have to match the key.
Additional examples can be shown in comparing the following lines from the same file:
Proposal
By changing the name of the virtual_hub_name to instead be virtual_hub_key we can distinguish between these two concepts more clearly and improve the user experience for people using the module.