Skip to content

Commit

Permalink
Add default_if_empty to google_compute_router_nat defaults (#5362)
Browse files Browse the repository at this point in the history
* Use more markdown for Bug

* Consistently use sentences for each bullet

* Rewrite bug reproduction block

* Allow domain mapping to succeed if DNS is pending

Signed-off-by: Modular Magician <magic-modules@google.com>

* Updated google_folder.html (#4149)

* Updated google_folder.html

The page in the first example shows that you should use organization_id with value of 1234567. In the Import example, it's not clear whether organization_id is user, or folder_id is used. API call behind this import command is only accepting folder_id (can be checked when setting TF_LOG to trace and viewing the API call)

* Update website/docs/r/google_folder.html.markdown

Co-Authored-By: Dana Hoffman <danahoffman@google.com>

Co-authored-by: Dana Hoffman <danahoffman@google.com>

* add google_kms_secret_ciphertext resource, deprecate datasource (#5314)

Signed-off-by: Modular Magician <magic-modules@google.com>

Co-authored-by: Dana Hoffman <danahoffman@google.com>

* Allow add/removing Bigtable clusters (#5318)

Signed-off-by: Modular Magician <magic-modules@google.com>

Co-authored-by: Riley Karson <rileykarson@google.com>

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

Signed-off-by: Modular Magician <magic-modules@google.com>

Co-authored-by: emily <emilyye@google.com>

* Update CHANGELOG.md

* fix docs for google_bigquery_default_service_account (#5329)

Signed-off-by: Modular Magician <magic-modules@google.com>

Co-authored-by: Martin Nowak <code@dawg.eu>

* Nil return for absent Bigtable resources (#5331)

Signed-off-by: Modular Magician <magic-modules@google.com>

Co-authored-by: Brian Hildebrandt <brian3.14159@gmail.com>

* add lifecycle_config to dataproc_cluster.cluster_config

Signed-off-by: Modular Magician <magic-modules@google.com>

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

Signed-off-by: Modular Magician <magic-modules@google.com>

Co-authored-by: emily <emilyye@google.com>

* Add mutex to peering create (#5338)

Signed-off-by: Modular Magician <magic-modules@google.com>

Co-authored-by: emily <emilyye@google.com>

* Add default_if_empty for quic_override (#5351)

Signed-off-by: Modular Magician <magic-modules@google.com>

Co-authored-by: Riley Karson <rileykarson@google.com>

* Batch errors now indicate how to disable batching

Signed-off-by: Modular Magician <magic-modules@google.com>

* Add default_if_empty to google_compute_router_nat defaults (#5353)

Signed-off-by: Modular Magician <magic-modules@google.com>

Co-authored-by: Riley Karson <rileykarson@google.com>

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

Signed-off-by: Modular Magician <magic-modules@google.com>

Co-authored-by: emily <emilyye@google.com>

* Add default_if_empty to google_compute_router_nat defaults (#2946)

Merged PR #2946.

Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
Co-authored-by: Chris Stephens <chrisst@google.com>
Co-authored-by: Petar Marinkovic <13387474+marinkovicpetar@users.noreply.github.com>
Co-authored-by: Dana Hoffman <danahoffman@google.com>
Co-authored-by: megan07 <mbang@hashicorp.com>
Co-authored-by: Riley Karson <rileykarson@google.com>
Co-authored-by: emily <emilyye@google.com>
Co-authored-by: Paddy <paddy@hashicorp.com>
Co-authored-by: Martin Nowak <code@dawg.eu>
Co-authored-by: Brian Hildebrandt <brian3.14159@gmail.com>
  • Loading branch information
11 people authored Jan 9, 2020
1 parent afbc4bb commit 2bdfad2
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/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
3 changes: 2 additions & 1 deletion google/resource_access_context_manager_service_perimeter.go
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/resource_compute_address.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,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/resource_compute_router_nat.go
Original file line number Diff line number Diff line change
Expand Up @@ -721,42 +721,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/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/resource_dns_managed_zone.go
Original file line number Diff line number Diff line change
Expand Up @@ -544,9 +544,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/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 2bdfad2

Please sign in to comment.