Skip to content
This repository has been archived by the owner on May 15, 2023. It is now read-only.

Added customize diff for params field in google_bigquery_data_transfer_config #1056

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions converters/google/resources/bigquerydatatransfer_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,31 @@ func sensitiveParamCustomizeDiff(_ context.Context, diff *schema.ResourceDiff, v
return nil
}

func paramsCustomizeDiff(_ context.Context, diff *schema.ResourceDiff, v interface{}) error {
old, new := diff.GetChange("params")
oldParams := old.(map[string]interface{})
newParams := new.(map[string]interface{})
var err error

if oldParams["data_path_template"] != nil && newParams["data_path_template"] != nil && oldParams["data_path_template"].(string) != newParams["data_path_template"].(string) {
err = diff.ForceNew("params")
if err != nil {
return fmt.Errorf("ForceNew failed for params, old - %v and new - %v", oldParams, newParams)
}
return nil
}

if oldParams["destination_table_name_template"] != nil && newParams["destination_table_name_template"] != nil && oldParams["destination_table_name_template"].(string) != newParams["destination_table_name_template"].(string) {
err = diff.ForceNew("params")
if err != nil {
return fmt.Errorf("ForceNew failed for params, old - %v and new - %v", oldParams, newParams)
}
return nil
}

return nil
}

const BigqueryDataTransferConfigAssetType string = "bigquerydatatransfer.googleapis.com/Config"

func resourceConverterBigqueryDataTransferConfig() ResourceConverter {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ require (
github.com/hashicorp/go-cleanhttp v0.5.2
github.com/hashicorp/terraform-json v0.14.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.18.0
github.com/hashicorp/terraform-provider-google v1.20.1-0.20221017172405-87e5292a7998
github.com/hashicorp/terraform-provider-google v1.20.1-0.20221017203128-eadde578bf73
github.com/mitchellh/go-homedir v1.1.0
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.8.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -653,8 +653,8 @@ github.com/hashicorp/terraform-plugin-log v0.4.1 h1:xpbmVhvuU3mgHzLetOmx9pkOL2rm
github.com/hashicorp/terraform-plugin-log v0.4.1/go.mod h1:p4R1jWBXRTvL4odmEkFfDdhUjHf9zcs/BCoNHAc7IK4=
github.com/hashicorp/terraform-plugin-sdk/v2 v2.18.0 h1:/cdI5di5XA+N80gXzXF4YcHq36DprBskubk6Z8i26ZQ=
github.com/hashicorp/terraform-plugin-sdk/v2 v2.18.0/go.mod h1:L3SHkD/Q8zPVgXviQmpVwy9nKwpXXZscVIpVEnQ/T50=
github.com/hashicorp/terraform-provider-google v1.20.1-0.20221017172405-87e5292a7998 h1:iyvfwbNA6xb3IKG+hIp1pikAVjYbWD7hd4qdtEsQ0ls=
github.com/hashicorp/terraform-provider-google v1.20.1-0.20221017172405-87e5292a7998/go.mod h1:TXv5NcGqgwMoBrbw5PL5WFEHMR4pJZiorclCbnZT024=
github.com/hashicorp/terraform-provider-google v1.20.1-0.20221017203128-eadde578bf73 h1:ULEDPaDZifw7UeTRoN2FFKTdtNBdOQJcT5pTcdSmTug=
github.com/hashicorp/terraform-provider-google v1.20.1-0.20221017203128-eadde578bf73/go.mod h1:TXv5NcGqgwMoBrbw5PL5WFEHMR4pJZiorclCbnZT024=
github.com/hashicorp/terraform-registry-address v0.0.0-20220623143253-7d51757b572c h1:D8aRO6+mTqHfLsK/BC3j5OAoogv1WLRWzY1AaTo3rBg=
github.com/hashicorp/terraform-registry-address v0.0.0-20220623143253-7d51757b572c/go.mod h1:Wn3Na71knbXc1G8Lh+yu/dQWWJeFQEpDeJMtWMtlmNI=
github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 h1:HKLsbzeOsfXmKNpr3GiT18XAblV0BjCbzL8KQAMZGa0=
Expand Down