github.com/minamijoyo/terraform@v0.7.8-0.20161029001309-18b3736ba44b/website/source/docs/providers/google/d/google_iam_policy.html.markdown (about)

     1  ---
     2  layout: "google"
     3  page_title: "Google: google_iam_policy"
     4  sidebar_current: "docs-google-datasource-iam-policy"
     5  description: |-
     6    Generates an IAM policy that can be referenced by other resources, applying
     7    the policy to them.
     8  ---
     9  
    10  # google\_iam\_policy
    11  
    12  Generates an IAM policy document that may be referenced by and applied to
    13  other Google Cloud Platform resources, such as the `google_project` resource.
    14  
    15  ```
    16  data "google_iam_policy" "admin" {
    17    binding {
    18      role = "roles/compute.instanceAdmin"
    19      members = [
    20        "serviceAccount:your-custom-sa@your-project.iam.gserviceaccount.com",
    21      ]
    22    }
    23    binding {
    24      role = "roles/storage.objectViewer"
    25      members = [
    26        "user:evanbrown@google.com",
    27      ]
    28    }
    29  }
    30  ```
    31  
    32  This data source is used to define IAM policies to apply to othe resources.
    33  Currently, defining a policy through a datasource and referencing that policy
    34  from another resource is the only way to apply an IAM policy to a resource.
    35  
    36  ## Argument Reference
    37  
    38  The following arguments are supported:
    39  
    40  * `binding` (Required) - A nested configuration block (described below)
    41    defining a binding to be included in the policy document. Multiple
    42    `binding` arguments are supported.
    43  
    44  Each document configuration must have one or more `binding` blocks, which
    45  each accept the following arguments:
    46  
    47  * `role` (Required) - The role/permission that will be granted to the members.
    48    See the [IAM Roles](https://cloud.google.com/compute/docs/access/iam) documentation for a complete list of roles.
    49  * `members` (Required) - An array of users/principals that will be granted
    50    the privilege in the `role`. For a human user, prefix the user's e-mail
    51    address with `user:` (e.g., `user:evandbrown@gmail.com`). For a service
    52    account, prefix the service account e-mail address with `serviceAccount:`
    53    (e.g., `serviceAccount:your-service-account@your-project.iam.gserviceaccount.com`).
    54  
    55  ## Attributes Reference
    56  
    57  The following attribute is exported:
    58  
    59  * `policy_data` - The above bindings serialized in a format suitable for
    60    referencing from a resource that supports IAM.