@@ -242,6 +242,16 @@ Changing this forces a new resource to be created.`,
242
242
Optional : true ,
243
243
Description : `Defines the time travel window in hours. The value can be from 48 to 168 hours (2 to 7 days).` ,
244
244
},
245
+ "resource_tags" : {
246
+ Type : schema .TypeMap ,
247
+ Optional : true ,
248
+ Description : `The tags attached to this table. Tag keys are globally unique. Tag key is expected to be
249
+ in the namespaced format, for example "123456789012/environment" where 123456789012 is the
250
+ ID of the parent organization or project resource for this tag key. Tag value is expected
251
+ to be the short name, for example "Production". See [Tag definitions](/iam/docs/tags-access-control#definitions)
252
+ for more details.` ,
253
+ Elem : & schema.Schema {Type : schema .TypeString },
254
+ },
245
255
"storage_billing_model" : {
246
256
Type : schema .TypeString ,
247
257
Computed : true ,
@@ -540,6 +550,12 @@ func resourceBigQueryDatasetCreate(d *schema.ResourceData, meta interface{}) err
540
550
} else if v , ok := d .GetOkExists ("storage_billing_model" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (storageBillingModelProp )) && (ok || ! reflect .DeepEqual (v , storageBillingModelProp )) {
541
551
obj ["storageBillingModel" ] = storageBillingModelProp
542
552
}
553
+ resourceTagsProp , err := expandBigQueryDatasetResourceTags (d .Get ("resource_tags" ), d , config )
554
+ if err != nil {
555
+ return err
556
+ } else if v , ok := d .GetOkExists ("resource_tags" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (resourceTagsProp )) && (ok || ! reflect .DeepEqual (v , resourceTagsProp )) {
557
+ obj ["resourceTags" ] = resourceTagsProp
558
+ }
543
559
labelsProp , err := expandBigQueryDatasetEffectiveLabels (d .Get ("effective_labels" ), d , config )
544
560
if err != nil {
545
561
return err
@@ -704,6 +720,9 @@ func resourceBigQueryDatasetRead(d *schema.ResourceData, meta interface{}) error
704
720
if err := d .Set ("storage_billing_model" , flattenBigQueryDatasetStorageBillingModel (res ["storageBillingModel" ], d , config )); err != nil {
705
721
return fmt .Errorf ("Error reading Dataset: %s" , err )
706
722
}
723
+ if err := d .Set ("resource_tags" , flattenBigQueryDatasetResourceTags (res ["resourceTags" ], d , config )); err != nil {
724
+ return fmt .Errorf ("Error reading Dataset: %s" , err )
725
+ }
707
726
if err := d .Set ("terraform_labels" , flattenBigQueryDatasetTerraformLabels (res ["labels" ], d , config )); err != nil {
708
727
return fmt .Errorf ("Error reading Dataset: %s" , err )
709
728
}
@@ -811,6 +830,12 @@ func resourceBigQueryDatasetUpdate(d *schema.ResourceData, meta interface{}) err
811
830
} else if v , ok := d .GetOkExists ("storage_billing_model" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (v )) && (ok || ! reflect .DeepEqual (v , storageBillingModelProp )) {
812
831
obj ["storageBillingModel" ] = storageBillingModelProp
813
832
}
833
+ resourceTagsProp , err := expandBigQueryDatasetResourceTags (d .Get ("resource_tags" ), d , config )
834
+ if err != nil {
835
+ return err
836
+ } else if v , ok := d .GetOkExists ("resource_tags" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (v )) && (ok || ! reflect .DeepEqual (v , resourceTagsProp )) {
837
+ obj ["resourceTags" ] = resourceTagsProp
838
+ }
814
839
labelsProp , err := expandBigQueryDatasetEffectiveLabels (d .Get ("effective_labels" ), d , config )
815
840
if err != nil {
816
841
return err
@@ -1252,6 +1277,10 @@ func flattenBigQueryDatasetStorageBillingModel(v interface{}, d *schema.Resource
1252
1277
return v
1253
1278
}
1254
1279
1280
+ func flattenBigQueryDatasetResourceTags (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
1281
+ return v
1282
+ }
1283
+
1255
1284
func flattenBigQueryDatasetTerraformLabels (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
1256
1285
if v == nil {
1257
1286
return v
@@ -1637,6 +1666,17 @@ func expandBigQueryDatasetStorageBillingModel(v interface{}, d tpgresource.Terra
1637
1666
return v , nil
1638
1667
}
1639
1668
1669
+ func expandBigQueryDatasetResourceTags (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (map [string ]string , error ) {
1670
+ if v == nil {
1671
+ return map [string ]string {}, nil
1672
+ }
1673
+ m := make (map [string ]string )
1674
+ for k , val := range v .(map [string ]interface {}) {
1675
+ m [k ] = val .(string )
1676
+ }
1677
+ return m , nil
1678
+ }
1679
+
1640
1680
func expandBigQueryDatasetEffectiveLabels (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (map [string ]string , error ) {
1641
1681
if v == nil {
1642
1682
return map [string ]string {}, nil
0 commit comments