@@ -53,6 +53,11 @@ func ResourceNetworkSecurityFirewallEndpoint() *schema.Resource {
5353 ),
5454
5555 Schema : map [string ]* schema.Schema {
56+ "billing_project_id" : {
57+ Type : schema .TypeString ,
58+ Required : true ,
59+ Description : `Project to bill on endpoint uptime usage.` ,
60+ },
5661 "location" : {
5762 Type : schema .TypeString ,
5863 Required : true ,
@@ -145,6 +150,12 @@ func resourceNetworkSecurityFirewallEndpointCreate(d *schema.ResourceData, meta
145150 }
146151
147152 obj := make (map [string ]interface {})
153+ billingProjectIdProp , err := expandNetworkSecurityFirewallEndpointBillingProjectId (d .Get ("billing_project_id" ), d , config )
154+ if err != nil {
155+ return err
156+ } else if v , ok := d .GetOkExists ("billing_project_id" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (billingProjectIdProp )) && (ok || ! reflect .DeepEqual (v , billingProjectIdProp )) {
157+ obj ["billingProjectId" ] = billingProjectIdProp
158+ }
148159 labelsProp , err := expandNetworkSecurityFirewallEndpointEffectiveLabels (d .Get ("effective_labels" ), d , config )
149160 if err != nil {
150161 return err
@@ -251,6 +262,9 @@ func resourceNetworkSecurityFirewallEndpointRead(d *schema.ResourceData, meta in
251262 if err := d .Set ("state" , flattenNetworkSecurityFirewallEndpointState (res ["state" ], d , config )); err != nil {
252263 return fmt .Errorf ("Error reading FirewallEndpoint: %s" , err )
253264 }
265+ if err := d .Set ("billing_project_id" , flattenNetworkSecurityFirewallEndpointBillingProjectId (res ["billingProjectId" ], d , config )); err != nil {
266+ return fmt .Errorf ("Error reading FirewallEndpoint: %s" , err )
267+ }
254268 if err := d .Set ("terraform_labels" , flattenNetworkSecurityFirewallEndpointTerraformLabels (res ["labels" ], d , config )); err != nil {
255269 return fmt .Errorf ("Error reading FirewallEndpoint: %s" , err )
256270 }
@@ -272,6 +286,12 @@ func resourceNetworkSecurityFirewallEndpointUpdate(d *schema.ResourceData, meta
272286 billingProject := ""
273287
274288 obj := make (map [string ]interface {})
289+ billingProjectIdProp , err := expandNetworkSecurityFirewallEndpointBillingProjectId (d .Get ("billing_project_id" ), d , config )
290+ if err != nil {
291+ return err
292+ } else if v , ok := d .GetOkExists ("billing_project_id" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (v )) && (ok || ! reflect .DeepEqual (v , billingProjectIdProp )) {
293+ obj ["billingProjectId" ] = billingProjectIdProp
294+ }
275295 labelsProp , err := expandNetworkSecurityFirewallEndpointEffectiveLabels (d .Get ("effective_labels" ), d , config )
276296 if err != nil {
277297 return err
@@ -287,6 +307,10 @@ func resourceNetworkSecurityFirewallEndpointUpdate(d *schema.ResourceData, meta
287307 log .Printf ("[DEBUG] Updating FirewallEndpoint %q: %#v" , d .Id (), obj )
288308 updateMask := []string {}
289309
310+ if d .HasChange ("billing_project_id" ) {
311+ updateMask = append (updateMask , "billingProjectId" )
312+ }
313+
290314 if d .HasChange ("effective_labels" ) {
291315 updateMask = append (updateMask , "labels" )
292316 }
@@ -437,6 +461,10 @@ func flattenNetworkSecurityFirewallEndpointState(v interface{}, d *schema.Resour
437461 return v
438462}
439463
464+ func flattenNetworkSecurityFirewallEndpointBillingProjectId (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
465+ return v
466+ }
467+
440468func flattenNetworkSecurityFirewallEndpointTerraformLabels (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
441469 if v == nil {
442470 return v
@@ -456,6 +484,10 @@ func flattenNetworkSecurityFirewallEndpointEffectiveLabels(v interface{}, d *sch
456484 return v
457485}
458486
487+ func expandNetworkSecurityFirewallEndpointBillingProjectId (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
488+ return v , nil
489+ }
490+
459491func expandNetworkSecurityFirewallEndpointEffectiveLabels (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (map [string ]string , error ) {
460492 if v == nil {
461493 return map [string ]string {}, nil
0 commit comments