Skip to main content


To switch billing for projects that are managed via Terraform, you will have to give the Terraform service account a billing user permission on the DoiT billing account and set/replace the billing_account value in your script.

Grant permission


To add the Terraform service account as Billing User, you should be a Billing Account Administrator for the DoiT Billing Account.

To grant permission for projects that are managed by Terraform, follow these steps:

  1. Sign in to the Google Cloud Console.

  2. Open the Cloud Console Navigation menu, and then select Billing.

    If you have more than one cloud billing account, do one of the following:

    To manage Cloud Billing for the current project, select Go to linked billing account.

    To locate a different Cloud Billing account, select Manage billing accounts and then choose the account that you want to manage.

  3. In the Billing navigation menu, click Account management.

  4. Use the Permissions panel to edit permissions for the selected Cloud Billing account. If the panel isn't already visible, click SHOW INFO PANEL to open it.

  5. Click Add Principal

  6. Input the terraform service account as New Principal and select Billing Account User role, then Save.

Default Billing Account

If an identity (in this case the terraform service account) only has access to a single billing account, GCP will use that as the default **billing_account**value in Terraform. You could use this behavior to ensure DoiT Billing Account is selected as the default by removing the Terraform service account's permission to any other billing accounts and/or explicitly set the DoiT Billing Account ID on your Terraform script. See steps below.

Set/Replace value for billing_account

As noted on Terraform documentation for Google Cloud Platform google_project, one of the arguments supported is billing_account. To associate the projects, simply set or replace its value with your DoiT Billing Account ID.


resource "google_project" "my_project" {
name = "My Project"
project_id = "your-project-id"
org_id = "1234567"
billing_account = "DoiT-Billing-Account-ID"