Map
Map
A map is represented as a key/value pair.
Example Resource
The Terraform Resource digitalocean_loadbalancer
(truncated for brevity)
...
forwarding_rule {
entry_port = 80
entry_protocol = "http"
target_port = 80
target_protocol = "http"
}
...
The keys entry_port
, entry_protocol
, target_port
and target_protocol
above and their respective values, 80
, and http
.
Source Code
The corresponding source code
"forwarding_rule": {
Type: schema.TypeSet,
Required: true,
MinItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"entry_protocol": {
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice([]string{
"http",
"https",
"http2",
"http3",
"tcp",
"udp",
}, false),
},
"entry_port": {
Type: schema.TypeInt,
Required: true,
ValidateFunc: validation.IntBetween(1, 65535),
},
"target_protocol": {
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice([]string{
"http",
"https",
"http2",
"tcp",
"udp",
}, false),
},
"target_port": {
Type: schema.TypeInt,
Required: true,
ValidateFunc: validation.IntBetween(1, 65535),
},
"certificate_id": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.NoZeroValues,
},
"tls_passthrough": {
Type: schema.TypeBool,
Optional: true,
Default: false,
},
},
},
Set: hashForwardingRules,
},