IAM policy for Billing Account

Three different resources help you manage IAM policies on billing accounts. Each of these resources serves a different use case:

google_billing_account_iam_policy

data "google_iam_policy" "admin" {
  binding {
    role = "roles/billing.viewer"
    members = [
      "user:jane@example.com",
    ]
  }
}

resource "google_billing_account_iam_policy" "editor" {
  billing_account_id = "00AA00-000AAA-00AA0A"
  policy_data        = data.google_iam_policy.admin.policy_data
}

google_billing_account_iam_binding

resource "google_billing_account_iam_binding" "editor" {
  billing_account_id = "00AA00-000AAA-00AA0A"
  role               = "roles/billing.viewer"
  members = [
    "user:jane@example.com",
  ]
}

google_billing_account_iam_member

resource "google_billing_account_iam_member" "editor" {
  billing_account_id = "00AA00-000AAA-00AA0A"
  role               = "roles/billing.viewer"
  member             = "user:jane@example.com"
}

Argument Reference

The following arguments are supported:

For google_billing_account_iam_member or google_billing_account_iam_binding:

google_billing_account_iam_policy only:


Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

Import

Importing IAM members

IAM member imports use space-delimited identifiers that contain the resource's billing_account_id, role, and member. For example:

An import block (Terraform v1.5.0 and later) can be used to import IAM members:

import {
  id = "{{billing_account_id}} roles/billing.user user:jane@example.com"
  to = google_billing_account_iam_member.default
}

The terraform import command can also be used:

$ terraform import google_billing_account_iam_member.default "{{billing_account_id}} roles/billing.user user:jane@example.com"

Importing IAM bindings

IAM binding imports use space-delimited identifiers that contain the resource's billing_account_id and role. For example:

An import block (Terraform v1.5.0 and later) can be used to import IAM bindings:

import {
  id = "{{billing_account_id}} roles/billing.user"
  to = google_billing_account_iam_binding.default
}

The terraform import command can also be used:

$ terraform import google_billing_account_iam_binding.default "{{billing_account_id}} roles/billing.user"

Importing IAM policies

IAM policy imports use the billing_account_id identifier of the Billing Account resource only. For example:

An import block (Terraform v1.5.0 and later) can be used to import IAM policies:

import {
  id = {{billing_account_id}}
  to = google_billing_account_iam_policy.default
}

The terraform import command can also be used:

$ terraform import google_billing_account_iam_policy.default {{billing_account_id}}