Ignore case on protocol and allocation types (#12176)
This commit is contained in:
parent
ad2860cabe
commit
9d34612be0
|
@ -311,3 +311,15 @@ func azureStateRefreshFunc(resourceURI string, client *ArmClient, command rivier
|
|||
func resourceAzurermResourceGroupNameDiffSuppress(k, old, new string, d *schema.ResourceData) bool {
|
||||
return strings.ToLower(old) == strings.ToLower(new)
|
||||
}
|
||||
|
||||
// ignoreCaseDiffSuppressFunc is a DiffSuppressFunc from helper/schema that is
|
||||
// used to ignore any case-changes in a return value.
|
||||
func ignoreCaseDiffSuppressFunc(k, old, new string, d *schema.ResourceData) bool {
|
||||
return strings.ToLower(old) == strings.ToLower(new)
|
||||
}
|
||||
|
||||
// ignoreCaseStateFunc is a StateFunc from helper/schema that converts the
|
||||
// supplied value to lower before saving to state for consistency.
|
||||
func ignoreCaseStateFunc(val interface{}) string {
|
||||
return strings.ToLower(val.(string))
|
||||
}
|
||||
|
|
|
@ -67,10 +67,12 @@ func resourceArmLoadBalancer() *schema.Resource {
|
|||
},
|
||||
|
||||
"private_ip_address_allocation": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
ValidateFunc: validateLoadBalancerPrivateIpAddressAllocation,
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
ValidateFunc: validateLoadBalancerPrivateIpAddressAllocation,
|
||||
StateFunc: ignoreCaseStateFunc,
|
||||
DiffSuppressFunc: ignoreCaseDiffSuppressFunc,
|
||||
},
|
||||
|
||||
"load_balancer_rules": {
|
||||
|
|
|
@ -51,8 +51,10 @@ func resourceArmLoadBalancerNatPool() *schema.Resource {
|
|||
},
|
||||
|
||||
"protocol": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
StateFunc: ignoreCaseStateFunc,
|
||||
DiffSuppressFunc: ignoreCaseDiffSuppressFunc,
|
||||
},
|
||||
|
||||
"frontend_port_start": {
|
||||
|
|
|
@ -51,8 +51,10 @@ func resourceArmLoadBalancerNatRule() *schema.Resource {
|
|||
},
|
||||
|
||||
"protocol": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
StateFunc: ignoreCaseStateFunc,
|
||||
DiffSuppressFunc: ignoreCaseDiffSuppressFunc,
|
||||
},
|
||||
|
||||
"frontend_port": {
|
||||
|
|
|
@ -51,9 +51,11 @@ func resourceArmLoadBalancerProbe() *schema.Resource {
|
|||
},
|
||||
|
||||
"protocol": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Optional: true,
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Optional: true,
|
||||
StateFunc: ignoreCaseStateFunc,
|
||||
DiffSuppressFunc: ignoreCaseDiffSuppressFunc,
|
||||
},
|
||||
|
||||
"port": {
|
||||
|
|
|
@ -69,8 +69,10 @@ func resourceArmLoadBalancerRule() *schema.Resource {
|
|||
},
|
||||
|
||||
"protocol": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
StateFunc: ignoreCaseStateFunc,
|
||||
DiffSuppressFunc: ignoreCaseDiffSuppressFunc,
|
||||
},
|
||||
|
||||
"frontend_port": {
|
||||
|
|
|
@ -79,9 +79,11 @@ func resourceArmNetworkInterface() *schema.Resource {
|
|||
},
|
||||
|
||||
"private_ip_address_allocation": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
ValidateFunc: validateNetworkInterfacePrivateIpAddressAllocation,
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
ValidateFunc: validateNetworkInterfacePrivateIpAddressAllocation,
|
||||
StateFunc: ignoreCaseStateFunc,
|
||||
DiffSuppressFunc: ignoreCaseDiffSuppressFunc,
|
||||
},
|
||||
|
||||
"public_ip_address_id": {
|
||||
|
|
|
@ -37,12 +37,11 @@ func resourceArmPublicIp() *schema.Resource {
|
|||
},
|
||||
|
||||
"public_ip_address_allocation": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
ValidateFunc: validatePublicIpAllocation,
|
||||
StateFunc: func(val interface{}) string {
|
||||
return strings.ToLower(val.(string))
|
||||
},
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
ValidateFunc: validatePublicIpAllocation,
|
||||
StateFunc: ignoreCaseStateFunc,
|
||||
DiffSuppressFunc: ignoreCaseDiffSuppressFunc,
|
||||
},
|
||||
|
||||
"idle_timeout_in_minutes": {
|
||||
|
|
Loading…
Reference in New Issue