terraform-provider-google/website/docs/r/google_project_iam_policy.html.markdown

2.6 KiB

layout page_title sidebar_current description
google Google: google_project_iam_policy docs-google-project-iam-policy Allows management of an IAM policy for a Google Cloud Platform project.

google_project_iam_policy

Allows creation and management of an IAM policy for an existing Google Cloud Platform project.

~> Be careful! You can accidentally lock yourself out of your project using this resource. Proceed with caution.

Example Usage

resource "google_project_iam_policy" "project" {
  project     = "your-project-id"
  policy_data = "${data.google_iam_policy.admin.policy_data}"
}

data "google_iam_policy" "admin" {
  binding {
    role = "roles/editor"

    members = [
      "user:jane@example.com",
    ]
  }
}

Argument Reference

The following arguments are supported:

  • project - (Required) The project ID. Changing this forces a new project to be created.

  • policy_data - (Required) The google_iam_policy data source that represents the IAM policy that will be applied to the project. The policy will be merged with any existing policy applied to the project.

    Changing this updates the policy.

    Deleting this removes the policy, but leaves the original project policy intact. If there are overlapping binding entries between the original project policy and the data source policy, they will be removed.

  • authoritative - (DEPRECATED) (Optional) A boolean value indicating if this policy should overwrite any existing IAM policy on the project. When set to true, any policies not in your config file will be removed. This can lock you out of your project until an Organization Administrator grants you access again, so please exercise caution. If this argument is true and you want to delete the resource, you must set the disable_project argument to true, acknowledging that the project will be inaccessible to anyone but the Organization Admins, as it will no longer have an IAM policy. Rather than using this, you should use google_project_iam_policy_binding and google_project_iam_policy_member.

  • disable_project - (DEPRECATED) (Optional) A boolean value that must be set to true if you want to delete a google_project_iam_policy that is authoritative.

Attributes Reference

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

  • etag - (Computed) The etag of the project's IAM policy.

  • restore_policy - (DEPRECATED) (Computed) The IAM policy that will be restored when a non-authoritative policy resource is deleted.