getRule

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

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const roleinfo = gcp.iam.getRule({
    name: "roles/compute.viewer",
});
export const theRolePermissions = roleinfo.then(roleinfo => roleinfo.includedPermissions);
import pulumi
import pulumi_gcp as gcp

roleinfo = gcp.iam.get_rule(name="roles/compute.viewer")
pulumi.export("theRolePermissions", roleinfo.included_permissions)
using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
    public MyStack()
    {
        var roleinfo = Output.Create(Gcp.Iam.GetRule.InvokeAsync(new Gcp.Iam.GetRuleArgs
        {
            Name = "roles/compute.viewer",
        }));
        this.TheRolePermissions = roleinfo.Apply(roleinfo => roleinfo.IncludedPermissions);
    }

    [Output("theRolePermissions")]
    public Output<string> TheRolePermissions { get; set; }
}
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v5/go/gcp/iam"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		roleinfo, err := iam.GetRule(ctx, &iam.GetRuleArgs{
			Name: "roles/compute.viewer",
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("theRolePermissions", roleinfo.IncludedPermissions)
		return nil
	})
}

Using getRule

function getRule(args: GetRuleArgs, opts?: InvokeOptions): Promise<GetRuleResult>
def get_rule(name: Optional[str] = None,
             opts: Optional[InvokeOptions] = None) -> GetRuleResult
func GetRule(ctx *Context, args *GetRuleArgs, opts ...InvokeOption) (*GetRuleResult, error)

Note: This function is named GetRule in the Go SDK.

public static class GetRule {
    public static Task<GetRuleResult> InvokeAsync(GetRuleArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

Name string
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}
Name string
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}
name string
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}
name str
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}

getRule Result

The following output properties are available:

Id string
The provider-assigned unique ID for this managed resource.
IncludedPermissions List<string>
specifies the list of one or more permissions to include in the custom role, such as - iam.roles.get
Name string
Stage string
indicates the stage of a role in the launch lifecycle, such as GA, BETA or ALPHA.
Title string
is a friendly title for the role, such as “Role Viewer”
Id string
The provider-assigned unique ID for this managed resource.
IncludedPermissions []string
specifies the list of one or more permissions to include in the custom role, such as - iam.roles.get
Name string
Stage string
indicates the stage of a role in the launch lifecycle, such as GA, BETA or ALPHA.
Title string
is a friendly title for the role, such as “Role Viewer”
id string
The provider-assigned unique ID for this managed resource.
includedPermissions string[]
specifies the list of one or more permissions to include in the custom role, such as - iam.roles.get
name string
stage string
indicates the stage of a role in the launch lifecycle, such as GA, BETA or ALPHA.
title string
is a friendly title for the role, such as “Role Viewer”
id str
The provider-assigned unique ID for this managed resource.
included_permissions Sequence[str]
specifies the list of one or more permissions to include in the custom role, such as - iam.roles.get
name str
stage str
indicates the stage of a role in the launch lifecycle, such as GA, BETA or ALPHA.
title str
is a friendly title for the role, such as “Role Viewer”

Package Details

Repository
https://github.com/pulumi/pulumi-gcp
License
Apache-2.0
Notes
This Pulumi package is based on the google-beta Terraform Provider.