@@ -30,6 +30,7 @@ import (
30
30
31
31
"github.com/hashicorp/terraform-provider-google/google/tpgresource"
32
32
transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport"
33
+ "github.com/hashicorp/terraform-provider-google/google/verify"
33
34
)
34
35
35
36
func ResourceCertificateManagerDnsAuthorization () * schema.Resource {
@@ -101,6 +102,21 @@ Please refer to the field 'effective_labels' for all of the labels present on th
101
102
Description : `The Certificate Manager location. If not specified, "global" is used.` ,
102
103
Default : "global" ,
103
104
},
105
+ "type" : {
106
+ Type : schema .TypeString ,
107
+ Computed : true ,
108
+ Optional : true ,
109
+ ForceNew : true ,
110
+ ValidateFunc : verify .ValidateEnum ([]string {"FIXED_RECORD" , "PER_PROJECT_RECORD" , "" }),
111
+ Description : `type of DNS authorization. If unset during the resource creation, FIXED_RECORD will
112
+ be used for global resources, and PER_PROJECT_RECORD will be used for other locations.
113
+
114
+ FIXED_RECORD DNS authorization uses DNS-01 validation method
115
+
116
+ PER_PROJECT_RECORD DNS authorization allows for independent management
117
+ of Google-managed certificates with DNS authorization across multiple
118
+ projects. Possible values: ["FIXED_RECORD", "PER_PROJECT_RECORD"]` ,
119
+ },
104
120
"dns_resource_record" : {
105
121
Type : schema .TypeList ,
106
122
Computed : true ,
@@ -172,6 +188,12 @@ func resourceCertificateManagerDnsAuthorizationCreate(d *schema.ResourceData, me
172
188
} else if v , ok := d .GetOkExists ("domain" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (domainProp )) && (ok || ! reflect .DeepEqual (v , domainProp )) {
173
189
obj ["domain" ] = domainProp
174
190
}
191
+ typeProp , err := expandCertificateManagerDnsAuthorizationType (d .Get ("type" ), d , config )
192
+ if err != nil {
193
+ return err
194
+ } else if v , ok := d .GetOkExists ("type" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (typeProp )) && (ok || ! reflect .DeepEqual (v , typeProp )) {
195
+ obj ["type" ] = typeProp
196
+ }
175
197
labelsProp , err := expandCertificateManagerDnsAuthorizationEffectiveLabels (d .Get ("effective_labels" ), d , config )
176
198
if err != nil {
177
199
return err
@@ -282,6 +304,9 @@ func resourceCertificateManagerDnsAuthorizationRead(d *schema.ResourceData, meta
282
304
if err := d .Set ("domain" , flattenCertificateManagerDnsAuthorizationDomain (res ["domain" ], d , config )); err != nil {
283
305
return fmt .Errorf ("Error reading DnsAuthorization: %s" , err )
284
306
}
307
+ if err := d .Set ("type" , flattenCertificateManagerDnsAuthorizationType (res ["type" ], d , config )); err != nil {
308
+ return fmt .Errorf ("Error reading DnsAuthorization: %s" , err )
309
+ }
285
310
if err := d .Set ("dns_resource_record" , flattenCertificateManagerDnsAuthorizationDnsResourceRecord (res ["dnsResourceRecord" ], d , config )); err != nil {
286
311
return fmt .Errorf ("Error reading DnsAuthorization: %s" , err )
287
312
}
@@ -477,6 +502,10 @@ func flattenCertificateManagerDnsAuthorizationDomain(v interface{}, d *schema.Re
477
502
return v
478
503
}
479
504
505
+ func flattenCertificateManagerDnsAuthorizationType (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
506
+ return v
507
+ }
508
+
480
509
func flattenCertificateManagerDnsAuthorizationDnsResourceRecord (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
481
510
if v == nil {
482
511
return nil
@@ -533,6 +562,10 @@ func expandCertificateManagerDnsAuthorizationDomain(v interface{}, d tpgresource
533
562
return v , nil
534
563
}
535
564
565
+ func expandCertificateManagerDnsAuthorizationType (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
566
+ return v , nil
567
+ }
568
+
536
569
func expandCertificateManagerDnsAuthorizationEffectiveLabels (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (map [string ]string , error ) {
537
570
if v == nil {
538
571
return map [string ]string {}, nil
0 commit comments