terraform-provider-google/website/docs/d/datasource_google_iam_role.html.markdown
Manuel Correa cefb6c6566 Add support for data source 'google_iam_role' (#2482)
Add `google_iam_role` data source to be able to fetch and query for GCP IAM roles permissions.
2018-12-20 17:22:22 -08:00

1.0 KiB

layout page_title sidebar_current description
google Google: google_iam_role docs-google-datasource-iam-role Get information about a Google IAM Role.

google_iam_role

Use this data source to get information about a Google IAM Role.

data "google_iam_role" "roleinfo" {
  name = "roles/compute.viewer"
}

output "the_role_permissions" {
  value = "${data.google_iam_role.roleinfo.included_permissions}"
}

Argument Reference

The following arguments are supported:

  • name (Required) - The name of the Role to lookup in the form roles/{ROLE_NAME}, organizations/{ORGANIZATION_ID}/roles/{ROLE_NAME} or projects/{PROJECT_ID}/roles/{ROLE_NAME}

Attributes Reference

The following attributes are exported:

  • title - is a friendly title for the role, such as "Role Viewer"
  • included_permissions - specifies the list of one or more permissions to include in the custom role, such as - iam.roles.get
  • stage - indicates the stage of a role in the launch lifecycle, such as GA, BETA or ALPHA.