IAM policy for Dataproc Job

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

google_dataproc_job_iam_policy

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

resource "google_dataproc_job_iam_policy" "editor" {
  project     = "your-project"
  region      = "your-region"
  job_id      = "your-dataproc-job"
  policy_data = data.google_iam_policy.admin.policy_data
}

google_dataproc_job_iam_binding

resource "google_dataproc_job_iam_binding" "editor" {
  job_id = "your-dataproc-job"
  role   = "roles/editor"
  members = [
    "user:jane@example.com",
  ]
}

google_dataproc_job_iam_member

resource "google_dataproc_job_iam_member" "editor" {
  job_id = "your-dataproc-job"
  role   = "roles/editor"
  member = "user:jane@example.com"
}

Argument Reference

The following arguments are supported:

For google_dataproc_job_iam_member or google_dataproc_job_iam_binding:

google_dataproc_job_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 job_id, role, and member. For example:

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

import {
  id = "projects/{project}/regions/{region}/jobs/{job_id} roles/editor user:jane@example.com"
  to = google_dataproc_job_iam_member.default
}

The terraform import command can also be used:

$ terraform import google_dataproc_job_iam_member.default "projects/{project}/regions/{region}/jobs/{job_id} roles/editor user:jane@example.com"

Importing IAM bindings

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

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

import {
  id = "projects/{project}/regions/{region}/jobs/{job_id} roles/editor"
  to = google_dataproc_job_iam_binding.default
}

The terraform import command can also be used:

$ terraform import google_dataproc_job_iam_binding.default "projects/{project}/regions/{region}/jobs/{job_id} roles/editor"

Importing IAM policies

IAM policy imports use the job_id identifier of the Dataproc Job resource only. For example:

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

import {
  id = "projects/{project}/regions/{region}/jobs/{job_id}"
  to = google_dataproc_job_iam_policy.default
}

The terraform import command can also be used:

$ terraform import google_dataproc_job_iam_policy.default "projects/{project}/regions/{region}/jobs/{job_id}"