Skip to content

Commit

Permalink
Add default_if_empty to google_compute_router_nat defaults (#1617)
Browse files Browse the repository at this point in the history
* Allow domain mapping to succeed if DNS is pending

Signed-off-by: Modular Magician <[email protected]>

* Update google_folder import description (#1592)

Signed-off-by: Modular Magician <[email protected]>

Co-authored-by: Dana Hoffman <[email protected]>

* add google_kms_secret_ciphertext resource, deprecate datasource (#1586)

Signed-off-by: Modular Magician <[email protected]>

Co-authored-by: Dana Hoffman <[email protected]>

* Allow add/removing Bigtable clusters (#1589)

Signed-off-by: Modular Magician <[email protected]>

Co-authored-by: Riley Karson <[email protected]>

* Add bootstrapped test networks for service networking tests (#1588)

Signed-off-by: Modular Magician <[email protected]>

Co-authored-by: emily <[email protected]>

* Update CHANGELOG.md

* fix docs for google_bigquery_default_service_account (#1596)

Signed-off-by: Modular Magician <[email protected]>

Co-authored-by: Martin Nowak <[email protected]>

* Nil return for absent Bigtable resources (#1597)

Signed-off-by: Modular Magician <[email protected]>

Co-authored-by: Brian Hildebrandt <[email protected]>

* add lifecycle_config to dataproc_cluster.cluster_config

Signed-off-by: Modular Magician <[email protected]>

* Add warnings about custom role format for IAM bindings (#1600)

Signed-off-by: Modular Magician <[email protected]>

Co-authored-by: emily <[email protected]>

* Add mutex to peering create (#1601)

Signed-off-by: Modular Magician <[email protected]>

Co-authored-by: emily <[email protected]>

* Add default_if_empty for quic_override (#1611)

Signed-off-by: Modular Magician <[email protected]>

Co-authored-by: Riley Karson <[email protected]>

* Batch errors now indicate how to disable batching

Signed-off-by: Modular Magician <[email protected]>

* Add default_if_empty to google_compute_router_nat defaults (#1613)

Signed-off-by: Modular Magician <[email protected]>

Co-authored-by: Riley Karson <[email protected]>

* Allow for retries of single requests in a batch on failure (#1615)

Signed-off-by: Modular Magician <[email protected]>

Co-authored-by: emily <[email protected]>

* Add default_if_empty to google_compute_router_nat defaults (#2946)

Merged PR #2946.

Co-authored-by: Chris Stephens <[email protected]>
Co-authored-by: Dana Hoffman <[email protected]>
Co-authored-by: Riley Karson <[email protected]>
Co-authored-by: emily <[email protected]>
Co-authored-by: Paddy <[email protected]>
Co-authored-by: Martin Nowak <[email protected]>
Co-authored-by: Brian Hildebrandt <[email protected]>
Co-authored-by: megan07 <[email protected]>
  • Loading branch information
9 people authored Jan 9, 2020
1 parent 3057892 commit fd6bf47
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .changelog/2946.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
compute: fixed `google_compute_router_nat` timeout fields causing a diff when using a long-lived resource
```
3 changes: 2 additions & 1 deletion google-beta/resource_access_context_manager_access_level.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,9 +462,10 @@ func flattenAccessContextManagerAccessLevelBasic(v interface{}, d *schema.Resour
return []interface{}{transformed}
}
func flattenAccessContextManagerAccessLevelBasicCombiningFunction(v interface{}, d *schema.ResourceData) interface{} {
if v == nil || v.(string) == "" {
if v == nil || isEmptyValue(reflect.ValueOf(v)) {
return "AND"
}

return v
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,9 +407,10 @@ func flattenAccessContextManagerServicePerimeterUpdateTime(v interface{}, d *sch
}

func flattenAccessContextManagerServicePerimeterPerimeterType(v interface{}, d *schema.ResourceData) interface{} {
if v == nil || v.(string) == "" {
if v == nil || isEmptyValue(reflect.ValueOf(v)) {
return "PERIMETER_TYPE_REGULAR"
}

return v
}

Expand Down
3 changes: 2 additions & 1 deletion google-beta/resource_compute_address.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,9 +472,10 @@ func flattenComputeAddressAddress(v interface{}, d *schema.ResourceData) interfa
}

func flattenComputeAddressAddressType(v interface{}, d *schema.ResourceData) interface{} {
if v == nil || v.(string) == "" {
if v == nil || isEmptyValue(reflect.ValueOf(v)) {
return "EXTERNAL"
}

return v
}

Expand Down
16 changes: 16 additions & 0 deletions google-beta/resource_compute_router_nat.go
Original file line number Diff line number Diff line change
Expand Up @@ -754,42 +754,58 @@ func flattenComputeRouterNatMinPortsPerVm(v interface{}, d *schema.ResourceData)
}

func flattenComputeRouterNatUdpIdleTimeoutSec(v interface{}, d *schema.ResourceData) interface{} {
if v == nil || isEmptyValue(reflect.ValueOf(v)) {
return 30
}
// 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.
}

return v
}

func flattenComputeRouterNatIcmpIdleTimeoutSec(v interface{}, d *schema.ResourceData) interface{} {
if v == nil || isEmptyValue(reflect.ValueOf(v)) {
return 30
}
// 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.
}

return v
}

func flattenComputeRouterNatTcpEstablishedIdleTimeoutSec(v interface{}, d *schema.ResourceData) interface{} {
if v == nil || isEmptyValue(reflect.ValueOf(v)) {
return 1200
}
// 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.
}

return v
}

func flattenComputeRouterNatTcpTransitoryIdleTimeoutSec(v interface{}, d *schema.ResourceData) interface{} {
if v == nil || isEmptyValue(reflect.ValueOf(v)) {
return 30
}
// 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.
}

return v
}

Expand Down
4 changes: 4 additions & 0 deletions google-beta/resource_compute_target_https_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,10 @@ func flattenComputeTargetHttpsProxyName(v interface{}, d *schema.ResourceData) i
}

func flattenComputeTargetHttpsProxyQuicOverride(v interface{}, d *schema.ResourceData) interface{} {
if v == nil || isEmptyValue(reflect.ValueOf(v)) {
return "NONE"
}

return v
}

Expand Down
3 changes: 2 additions & 1 deletion google-beta/resource_dns_managed_zone.go
Original file line number Diff line number Diff line change
Expand Up @@ -645,9 +645,10 @@ func flattenDNSManagedZoneLabels(v interface{}, d *schema.ResourceData) interfac
}

func flattenDNSManagedZoneVisibility(v interface{}, d *schema.ResourceData) interface{} {
if v == nil || v.(string) == "" {
if v == nil || isEmptyValue(reflect.ValueOf(v)) {
return "public"
}

return v
}

Expand Down
3 changes: 2 additions & 1 deletion google-beta/resource_logging_metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -586,9 +586,10 @@ func flattenLoggingMetricMetricDescriptorLabelsDescription(v interface{}, d *sch
}

func flattenLoggingMetricMetricDescriptorLabelsValueType(v interface{}, d *schema.ResourceData) interface{} {
if v == nil || v.(string) == "" {
if v == nil || isEmptyValue(reflect.ValueOf(v)) {
return "STRING"
}

return v
}

Expand Down

0 comments on commit fd6bf47

Please sign in to comment.