Skip to main content


To switch billing for projects that are managed via Terraform, you have to grant 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

Required Permission

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

See also

To grant permission for projects that are managed by Terraform:

  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:

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

    • To use a different Cloud Billing account, select Manage billing accounts and then choose the account of interest.

  3. In the Billing Account Overview window, select the Manage option next to the billing account.

    The location of the Manage option.

  4. In the Info Panel pane on the right, select Add Principal.

  5. In the New principals field, enter the Terraform service account.

  6. From the Select a role drop-down list, select the Billing Account User role.

  7. Save your changes.

Set/Replace value for billing_account

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.

To ensure your DoiT Billing account is selected as the default, you can remove the Terraform service account's permission to other billing accounts and/or explicitly set the DoiT Billing account ID in your Terraform script.

As noted on Terraform documentation for Google Cloud Platform google_project, one of the arguments supported is billing_account.

To associate the projects, 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"