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

Added CMEK support for cloud data fusion #1031

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
29 changes: 29 additions & 0 deletions converters/google/resources/datafusion_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ func GetDataFusionInstanceApiObject(d TerraformResourceData, config *Config) (ma
} else if v, ok := d.GetOkExists("network_config"); !isEmptyValue(reflect.ValueOf(networkConfigProp)) && (ok || !reflect.DeepEqual(v, networkConfigProp)) {
obj["networkConfig"] = networkConfigProp
}
cryptoKeyConfigProp, err := expandDataFusionInstanceCryptoKeyConfig(d.Get("crypto_key_config"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("crypto_key_config"); !isEmptyValue(reflect.ValueOf(cryptoKeyConfigProp)) && (ok || !reflect.DeepEqual(v, cryptoKeyConfigProp)) {
obj["cryptoKeyConfig"] = cryptoKeyConfigProp
}

return obj, nil
}
Expand Down Expand Up @@ -205,3 +211,26 @@ func expandDataFusionInstanceNetworkConfigIpAllocation(v interface{}, d Terrafor
func expandDataFusionInstanceNetworkConfigNetwork(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}

func expandDataFusionInstanceCryptoKeyConfig(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
l := v.([]interface{})
if len(l) == 0 || l[0] == nil {
return nil, nil
}
raw := l[0]
original := raw.(map[string]interface{})
transformed := make(map[string]interface{})

transformedKeyReference, err := expandDataFusionInstanceCryptoKeyConfigKeyReference(original["key_reference"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedKeyReference); val.IsValid() && !isEmptyValue(val) {
transformed["keyReference"] = transformedKeyReference
}

return transformed, nil
}

func expandDataFusionInstanceCryptoKeyConfigKeyReference(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}
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.20221006222948-fb0cd39711ff
github.com/hashicorp/terraform-provider-google v1.20.1-0.20221006233713-b2abd5d517a2
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 @@ -650,8 +650,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.20221006222948-fb0cd39711ff h1:JFuEc8OeeJljJIL/tQxN1IB849wVzO8Trkh+wFrZA9Y=
github.com/hashicorp/terraform-provider-google v1.20.1-0.20221006222948-fb0cd39711ff/go.mod h1:XkWEq9m0whYwjW0vmHmzjskXkneDxOIKcAYQNaAyo7s=
github.com/hashicorp/terraform-provider-google v1.20.1-0.20221006233713-b2abd5d517a2 h1:DHsF76ZPqr24kOdC+bt2Td2hKQmeGjhNgeniyRHQ7HU=
github.com/hashicorp/terraform-provider-google v1.20.1-0.20221006233713-b2abd5d517a2/go.mod h1:XkWEq9m0whYwjW0vmHmzjskXkneDxOIKcAYQNaAyo7s=
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