Skip to content

Commit

Permalink
Add default_if_empty to google_compute_router_nat defaults
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
rileykarson authored and modular-magician committed Jan 9, 2020
1 parent 5957448 commit 3f13c6e
Showing 1 changed file with 8 additions and 20 deletions.
28 changes: 8 additions & 20 deletions google/resource_compute_router_nat.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 3f13c6e

Please sign in to comment.