From fb67da5218740184f7f553196fc1de899c4fbe29 Mon Sep 17 00:00:00 2001 From: Modular Magician Date: Fri, 1 Mar 2024 09:51:22 +0000 Subject: [PATCH] Add type field to DNS authorization reosurce (#10030) * Add type field to DNS authorization reosurce * Add an example for regional DNS authorization * Add an example for regional certs using regional DNS auth * Fix lint errors * Fix typo in the enum values * Add type field in regional dns auth example --------- Co-authored-by: Hamza Hassan [upstream:0ac8f5283f99aca69ac1821ecbc67200d45b0390] Signed-off-by: Modular Magician --- go.mod | 2 +- go.sum | 4 ++-- .../certificatemanager_dns_authorization.go | 10 ++++++++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index afd1729f1..c6de00cb3 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/hashicorp/hcl/v2 v2.19.1 github.com/hashicorp/terraform-json v0.18.0 github.com/hashicorp/terraform-plugin-sdk/v2 v2.31.0 - github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20240301000621-f3462a7e0dd9 + github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20240301094629-99a8f0b964a3 github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/pkg/errors v0.9.1 github.com/stretchr/testify v1.8.4 diff --git a/go.sum b/go.sum index 84fa040f5..ad17d2753 100644 --- a/go.sum +++ b/go.sum @@ -175,8 +175,8 @@ github.com/hashicorp/terraform-plugin-log v0.9.0/go.mod h1:rKL8egZQ/eXSyDqzLUuwU github.com/hashicorp/terraform-plugin-mux v0.13.0 h1:79U401/3nd8CWwDGtTHc8F3miSCAS9XGtVarxSTDgwA= github.com/hashicorp/terraform-plugin-sdk/v2 v2.31.0 h1:Bl3e2ei2j/Z3Hc2HIS15Gal2KMKyLAZ2om1HCEvK6es= github.com/hashicorp/terraform-plugin-sdk/v2 v2.31.0/go.mod h1:i2C41tszDjiWfziPQDL5R/f3Zp0gahXe5No/MIO9rCE= -github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20240301000621-f3462a7e0dd9 h1:yctvymPVptlwEb0XI31pCRw4s/aVjVY8FYsijcGkCbM= -github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20240301000621-f3462a7e0dd9/go.mod h1:vJFmOnOpcf+5wEYfWdY0hXALTVCUdbj1PZmM0VHG48I= +github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20240301094629-99a8f0b964a3 h1:LnRVZaSPX1s7rm4zZy9aaWq7We5qLepWlAFpa6PwIQQ= +github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20240301094629-99a8f0b964a3/go.mod h1:vJFmOnOpcf+5wEYfWdY0hXALTVCUdbj1PZmM0VHG48I= github.com/hashicorp/terraform-registry-address v0.2.3 h1:2TAiKJ1A3MAkZlH1YI/aTVcLZRu7JseiXNRHbOAyoTI= github.com/hashicorp/terraform-registry-address v0.2.3/go.mod h1:lFHA76T8jfQteVfT7caREqguFrW3c4MFSPhZB7HHgUM= github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S52uzrw4x0jKQ= diff --git a/tfplan2cai/converters/google/resources/services/certificatemanager/certificatemanager_dns_authorization.go b/tfplan2cai/converters/google/resources/services/certificatemanager/certificatemanager_dns_authorization.go index 5140f2e3c..1f790f131 100644 --- a/tfplan2cai/converters/google/resources/services/certificatemanager/certificatemanager_dns_authorization.go +++ b/tfplan2cai/converters/google/resources/services/certificatemanager/certificatemanager_dns_authorization.go @@ -66,6 +66,12 @@ func GetCertificateManagerDnsAuthorizationApiObject(d tpgresource.TerraformResou } else if v, ok := d.GetOkExists("domain"); !tpgresource.IsEmptyValue(reflect.ValueOf(domainProp)) && (ok || !reflect.DeepEqual(v, domainProp)) { obj["domain"] = domainProp } + typeProp, err := expandCertificateManagerDnsAuthorizationType(d.Get("type"), d, config) + if err != nil { + return nil, err + } else if v, ok := d.GetOkExists("type"); !tpgresource.IsEmptyValue(reflect.ValueOf(typeProp)) && (ok || !reflect.DeepEqual(v, typeProp)) { + obj["type"] = typeProp + } labelsProp, err := expandCertificateManagerDnsAuthorizationEffectiveLabels(d.Get("effective_labels"), d, config) if err != nil { return nil, err @@ -84,6 +90,10 @@ func expandCertificateManagerDnsAuthorizationDomain(v interface{}, d tpgresource return v, nil } +func expandCertificateManagerDnsAuthorizationType(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { + return v, nil +} + func expandCertificateManagerDnsAuthorizationEffectiveLabels(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (map[string]string, error) { if v == nil { return map[string]string{}, nil