@@ -376,6 +376,13 @@ account and all subaccounts, if they exist.
376376 Optional : true ,
377377 Description : `User data for display name in UI. Must be <= 60 chars.` ,
378378 },
379+ "ownership_scope" : {
380+ Type : schema .TypeString ,
381+ Optional : true ,
382+ ValidateFunc : verify .ValidateEnum ([]string {"OWNERSHIP_SCOPE_UNSPECIFIED" , "ALL_USERS" , "BILLING_ACCOUNT" , "" }),
383+ Description : `The ownership scope of the budget. The ownership scope and users'
384+ IAM permissions determine who has full access to the budget's data. Possible values: ["OWNERSHIP_SCOPE_UNSPECIFIED", "ALL_USERS", "BILLING_ACCOUNT"]` ,
385+ },
379386 "threshold_rules" : {
380387 Type : schema .TypeList ,
381388 Optional : true ,
@@ -451,6 +458,12 @@ func resourceBillingBudgetCreate(d *schema.ResourceData, meta interface{}) error
451458 } else if v , ok := d .GetOkExists ("all_updates_rule" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (notificationsRuleProp )) && (ok || ! reflect .DeepEqual (v , notificationsRuleProp )) {
452459 obj ["notificationsRule" ] = notificationsRuleProp
453460 }
461+ ownershipScopeProp , err := expandBillingBudgetOwnershipScope (d .Get ("ownership_scope" ), d , config )
462+ if err != nil {
463+ return err
464+ } else if v , ok := d .GetOkExists ("ownership_scope" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (ownershipScopeProp )) && (ok || ! reflect .DeepEqual (v , ownershipScopeProp )) {
465+ obj ["ownershipScope" ] = ownershipScopeProp
466+ }
454467
455468 url , err := tpgresource .ReplaceVars (d , config , "{{BillingBasePath}}billingAccounts/{{billing_account}}/budgets" )
456469 if err != nil {
@@ -545,6 +558,9 @@ func resourceBillingBudgetRead(d *schema.ResourceData, meta interface{}) error {
545558 if err := d .Set ("all_updates_rule" , flattenBillingBudgetAllUpdatesRule (res ["notificationsRule" ], d , config )); err != nil {
546559 return fmt .Errorf ("Error reading Budget: %s" , err )
547560 }
561+ if err := d .Set ("ownership_scope" , flattenBillingBudgetOwnershipScope (res ["ownershipScope" ], d , config )); err != nil {
562+ return fmt .Errorf ("Error reading Budget: %s" , err )
563+ }
548564
549565 return nil
550566}
@@ -589,6 +605,12 @@ func resourceBillingBudgetUpdate(d *schema.ResourceData, meta interface{}) error
589605 } else if v , ok := d .GetOkExists ("all_updates_rule" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (v )) && (ok || ! reflect .DeepEqual (v , notificationsRuleProp )) {
590606 obj ["notificationsRule" ] = notificationsRuleProp
591607 }
608+ ownershipScopeProp , err := expandBillingBudgetOwnershipScope (d .Get ("ownership_scope" ), d , config )
609+ if err != nil {
610+ return err
611+ } else if v , ok := d .GetOkExists ("ownership_scope" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (v )) && (ok || ! reflect .DeepEqual (v , ownershipScopeProp )) {
612+ obj ["ownershipScope" ] = ownershipScopeProp
613+ }
592614
593615 url , err := tpgresource .ReplaceVars (d , config , "{{BillingBasePath}}billingAccounts/{{billing_account}}/budgets/{{name}}" )
594616 if err != nil {
@@ -631,6 +653,10 @@ func resourceBillingBudgetUpdate(d *schema.ResourceData, meta interface{}) error
631653 "notificationsRule.monitoringNotificationChannels" ,
632654 "notificationsRule.disableDefaultIamRecipients" )
633655 }
656+
657+ if d .HasChange ("ownership_scope" ) {
658+ updateMask = append (updateMask , "ownershipScope" )
659+ }
634660 // updateMask is a URL parameter but not present in the schema, so ReplaceVars
635661 // won't set it
636662 url , err = transport_tpg .AddQueryParams (url , map [string ]string {"updateMask" : strings .Join (updateMask , "," )})
@@ -1106,6 +1132,10 @@ func flattenBillingBudgetAllUpdatesRuleDisableDefaultIamRecipients(v interface{}
11061132 return v
11071133}
11081134
1135+ func flattenBillingBudgetOwnershipScope (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
1136+ return v
1137+ }
1138+
11091139func expandBillingBudgetDisplayName (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
11101140 return v , nil
11111141}
@@ -1514,6 +1544,10 @@ func expandBillingBudgetAllUpdatesRuleDisableDefaultIamRecipients(v interface{},
15141544 return v , nil
15151545}
15161546
1547+ func expandBillingBudgetOwnershipScope (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
1548+ return v , nil
1549+ }
1550+
15171551func resourceBillingBudgetResourceV0 () * schema.Resource {
15181552 return & schema.Resource {
15191553 Schema : map [string ]* schema.Schema {
0 commit comments