@@ -62,6 +62,23 @@ func ResourceBigtableAppProfile() *schema.Resource {
6262 ForceNew : true ,
6363 Description : `The unique name of the app profile in the form '[_a-zA-Z0-9][-_.a-zA-Z0-9]*'.` ,
6464 },
65+ "data_boost_isolation_read_only" : {
66+ Type : schema .TypeList ,
67+ Optional : true ,
68+ Description : `Specifies that this app profile is intended for read-only usage via the Data Boost feature.` ,
69+ MaxItems : 1 ,
70+ Elem : & schema.Resource {
71+ Schema : map [string ]* schema.Schema {
72+ "compute_billing_owner" : {
73+ Type : schema .TypeString ,
74+ Required : true ,
75+ ValidateFunc : verify .ValidateEnum ([]string {"HOST_PAYS" }),
76+ Description : `The Compute Billing Owner for this Data Boost App Profile. Possible values: ["HOST_PAYS"]` ,
77+ },
78+ },
79+ },
80+ ConflictsWith : []string {"standard_isolation" },
81+ },
6582 "description" : {
6683 Type : schema .TypeString ,
6784 Optional : true ,
@@ -126,6 +143,7 @@ It is unsafe to send these requests to the same table/row/column in multiple clu
126143 },
127144 },
128145 },
146+ ConflictsWith : []string {"data_boost_isolation_read_only" },
129147 },
130148 "name" : {
131149 Type : schema .TypeString ,
@@ -184,6 +202,12 @@ func resourceBigtableAppProfileCreate(d *schema.ResourceData, meta interface{})
184202 } else if v , ok := d .GetOkExists ("standard_isolation" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (standardIsolationProp )) && (ok || ! reflect .DeepEqual (v , standardIsolationProp )) {
185203 obj ["standardIsolation" ] = standardIsolationProp
186204 }
205+ dataBoostIsolationReadOnlyProp , err := expandBigtableAppProfileDataBoostIsolationReadOnly (d .Get ("data_boost_isolation_read_only" ), d , config )
206+ if err != nil {
207+ return err
208+ } else if v , ok := d .GetOkExists ("data_boost_isolation_read_only" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (dataBoostIsolationReadOnlyProp )) && (ok || ! reflect .DeepEqual (v , dataBoostIsolationReadOnlyProp )) {
209+ obj ["dataBoostIsolationReadOnly" ] = dataBoostIsolationReadOnlyProp
210+ }
187211
188212 obj , err = resourceBigtableAppProfileEncoder (d , meta , obj )
189213 if err != nil {
@@ -296,6 +320,9 @@ func resourceBigtableAppProfileRead(d *schema.ResourceData, meta interface{}) er
296320 if err := d .Set ("standard_isolation" , flattenBigtableAppProfileStandardIsolation (res ["standardIsolation" ], d , config )); err != nil {
297321 return fmt .Errorf ("Error reading AppProfile: %s" , err )
298322 }
323+ if err := d .Set ("data_boost_isolation_read_only" , flattenBigtableAppProfileDataBoostIsolationReadOnly (res ["dataBoostIsolationReadOnly" ], d , config )); err != nil {
324+ return fmt .Errorf ("Error reading AppProfile: %s" , err )
325+ }
299326
300327 return nil
301328}
@@ -340,6 +367,12 @@ func resourceBigtableAppProfileUpdate(d *schema.ResourceData, meta interface{})
340367 } else if v , ok := d .GetOkExists ("standard_isolation" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (v )) && (ok || ! reflect .DeepEqual (v , standardIsolationProp )) {
341368 obj ["standardIsolation" ] = standardIsolationProp
342369 }
370+ dataBoostIsolationReadOnlyProp , err := expandBigtableAppProfileDataBoostIsolationReadOnly (d .Get ("data_boost_isolation_read_only" ), d , config )
371+ if err != nil {
372+ return err
373+ } else if v , ok := d .GetOkExists ("data_boost_isolation_read_only" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (v )) && (ok || ! reflect .DeepEqual (v , dataBoostIsolationReadOnlyProp )) {
374+ obj ["dataBoostIsolationReadOnly" ] = dataBoostIsolationReadOnlyProp
375+ }
343376
344377 obj , err = resourceBigtableAppProfileEncoder (d , meta , obj )
345378 if err != nil {
@@ -370,6 +403,10 @@ func resourceBigtableAppProfileUpdate(d *schema.ResourceData, meta interface{})
370403 if d .HasChange ("standard_isolation" ) {
371404 updateMask = append (updateMask , "standardIsolation" )
372405 }
406+
407+ if d .HasChange ("data_boost_isolation_read_only" ) {
408+ updateMask = append (updateMask , "dataBoostIsolationReadOnly" )
409+ }
373410 // updateMask is a URL parameter but not present in the schema, so ReplaceVars
374411 // won't set it
375412 url , err = transport_tpg .AddQueryParams (url , map [string ]string {"updateMask" : strings .Join (updateMask , "," )})
@@ -396,6 +433,16 @@ func resourceBigtableAppProfileUpdate(d *schema.ResourceData, meta interface{})
396433 }
397434 }
398435 }
436+
437+ _ , hasStandardIsolation := obj ["standardIsolation" ]
438+ _ , hasDataBoostIsolationReadOnly := obj ["dataBoostIsolationReadOnly" ]
439+ if hasStandardIsolation && hasDataBoostIsolationReadOnly {
440+ // Due to the "conflicts" both fields should be present only if neither was
441+ // previously specified and the user is now manually adding dataBoostIsolationReadOnly.
442+ delete (obj , "standardIsolation" )
443+ updateMask = append (updateMask , "dataBoostIsolationReadOnly" )
444+ }
445+
399446 // updateMask is a URL parameter but not present in the schema, so ReplaceVars
400447 // won't set it
401448 url , err = transport_tpg .AddQueryParams (url , map [string ]string {"updateMask" : strings .Join (updateMask , "," )})
@@ -566,6 +613,23 @@ func flattenBigtableAppProfileStandardIsolationPriority(v interface{}, d *schema
566613 return v
567614}
568615
616+ func flattenBigtableAppProfileDataBoostIsolationReadOnly (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
617+ if v == nil {
618+ return nil
619+ }
620+ original := v .(map [string ]interface {})
621+ if len (original ) == 0 {
622+ return nil
623+ }
624+ transformed := make (map [string ]interface {})
625+ transformed ["compute_billing_owner" ] =
626+ flattenBigtableAppProfileDataBoostIsolationReadOnlyComputeBillingOwner (original ["computeBillingOwner" ], d , config )
627+ return []interface {}{transformed }
628+ }
629+ func flattenBigtableAppProfileDataBoostIsolationReadOnlyComputeBillingOwner (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
630+ return v
631+ }
632+
569633func expandBigtableAppProfileDescription (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
570634 return v , nil
571635}
@@ -643,6 +707,29 @@ func expandBigtableAppProfileStandardIsolationPriority(v interface{}, d tpgresou
643707 return v , nil
644708}
645709
710+ func expandBigtableAppProfileDataBoostIsolationReadOnly (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
711+ l := v .([]interface {})
712+ if len (l ) == 0 || l [0 ] == nil {
713+ return nil , nil
714+ }
715+ raw := l [0 ]
716+ original := raw .(map [string ]interface {})
717+ transformed := make (map [string ]interface {})
718+
719+ transformedComputeBillingOwner , err := expandBigtableAppProfileDataBoostIsolationReadOnlyComputeBillingOwner (original ["compute_billing_owner" ], d , config )
720+ if err != nil {
721+ return nil , err
722+ } else if val := reflect .ValueOf (transformedComputeBillingOwner ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
723+ transformed ["computeBillingOwner" ] = transformedComputeBillingOwner
724+ }
725+
726+ return transformed , nil
727+ }
728+
729+ func expandBigtableAppProfileDataBoostIsolationReadOnlyComputeBillingOwner (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
730+ return v , nil
731+ }
732+
646733func resourceBigtableAppProfileEncoder (d * schema.ResourceData , meta interface {}, obj map [string ]interface {}) (map [string ]interface {}, error ) {
647734 // Instance is a URL parameter only, so replace self-link/path with resource name only.
648735 if err := d .Set ("instance" , tpgresource .GetResourceNameFromSelfLink (d .Get ("instance" ).(string ))); err != nil {
0 commit comments