hcp_project_iam_policy (Resource)

Sets the project's IAM policy and replaces any existing policy.

Example Usage

data "hcp_iam_policy" "example" {
  bindings = [
    {
      role = "roles/contributor"
      principals = [
        "example-user-id-1",
        "example-group-id-1",
        "example-sp-1"
      ]
    },
  ]
}

resource "hcp_project" "my_project" {
  name = "example"
}

resource "hcp_project_iam_policy" "project_policy" {
  project_id  = hcp_project.my_project.resource_id
  policy_data = data.hcp_iam_policy.example.policy_data
}

Schema

Required

Optional

Read-Only

Import

Import is supported using the following syntax:

# Project IAM Policy can be imported by specifying the project id
terraform import hcp_project_iam_policy.example 840e3701-55b6-4f86-8c17-b1fe397303c5