diff --git a/google/resource_compute_router_nat.go b/google/resource_compute_router_nat.go index fa8c82a4306..22956cbb7ff 100644 --- a/google/resource_compute_router_nat.go +++ b/google/resource_compute_router_nat.go @@ -721,41 +721,29 @@ func flattenComputeRouterNatMinPortsPerVm(v interface{}, d *schema.ResourceData) } func flattenComputeRouterNatUdpIdleTimeoutSec(v interface{}, d *schema.ResourceData) interface{} { - // Handles the string fixed64 format - if strVal, ok := v.(string); ok { - if intVal, err := strconv.ParseInt(strVal, 10, 64); err == nil { - return intVal - } // let terraform core handle it if we can't convert the string to an int. + if v == nil || v.(string) == "" { + return 30 } return v } func flattenComputeRouterNatIcmpIdleTimeoutSec(v interface{}, d *schema.ResourceData) interface{} { - // Handles the string fixed64 format - if strVal, ok := v.(string); ok { - if intVal, err := strconv.ParseInt(strVal, 10, 64); err == nil { - return intVal - } // let terraform core handle it if we can't convert the string to an int. + if v == nil || v.(string) == "" { + return 30 } return v } func flattenComputeRouterNatTcpEstablishedIdleTimeoutSec(v interface{}, d *schema.ResourceData) interface{} { - // Handles the string fixed64 format - if strVal, ok := v.(string); ok { - if intVal, err := strconv.ParseInt(strVal, 10, 64); err == nil { - return intVal - } // let terraform core handle it if we can't convert the string to an int. + if v == nil || v.(string) == "" { + return 1200 } return v } func flattenComputeRouterNatTcpTransitoryIdleTimeoutSec(v interface{}, d *schema.ResourceData) interface{} { - // Handles the string fixed64 format - if strVal, ok := v.(string); ok { - if intVal, err := strconv.ParseInt(strVal, 10, 64); err == nil { - return intVal - } // let terraform core handle it if we can't convert the string to an int. + if v == nil || v.(string) == "" { + return 30 } return v }