Yandex

v0.10.0 published on Thursday, Nov 18, 2021 by Pulumi

getIamRole

Generates an [IAM] role document that may be referenced by and applied to other Yandex.Cloud Platform resources, such as the yandex.ResourcemanagerFolder resource. For more information, see the official documentation.

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

const admin = pulumi.output(yandex.getIamRole({
    binding: [{
        members: ["userAccount:user_id_1"],
        role: "admin",
    }],
}));
import pulumi
import pulumi_yandex as yandex

admin = yandex.get_iam_role(binding=[{
    "members": ["userAccount:user_id_1"],
    "role": "admin",
}])
using Pulumi;
using Yandex = Pulumi.Yandex;

class MyStack : Stack
{
    public MyStack()
    {
        var admin = Output.Create(Yandex.GetIamRole.InvokeAsync(new Yandex.GetIamRoleArgs
        {
            Binding = 
            {
                
                {
                    { "members", 
                    {
                        "userAccount:user_id_1",
                    } },
                    { "role", "admin" },
                },
            },
        }));
    }

}
package main

import (
	"github.com/pulumi/pulumi-yandex/sdk/go/yandex"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := yandex.GetIamRole(ctx, &GetIamRoleArgs{
			Binding: []map[string]interface{}{
				map[string]interface{}{
					"members": []string{
						"userAccount:user_id_1",
					},
					"role": "admin",
				},
			},
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}

This data source is used to define [IAM] roles in order to apply them to other resources. Currently, defining a role through a data source and referencing that role from another resource is the only way to apply an IAM role to a resource.

Using getIamRole

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getIamRole(args: GetIamRoleArgs, opts?: InvokeOptions): Promise<GetIamRoleResult>
function getIamRoleOutput(args: GetIamRoleOutputArgs, opts?: InvokeOptions): Output<GetIamRoleResult>
def get_iam_role(description: Optional[str] = None,
                 role_id: Optional[str] = None,
                 opts: Optional[InvokeOptions] = None) -> GetIamRoleResult
def get_iam_role_output(description: Optional[pulumi.Input[str]] = None,
                 role_id: Optional[pulumi.Input[str]] = None,
                 opts: Optional[InvokeOptions] = None) -> Output[GetIamRoleResult]
func GetIamRole(ctx *Context, args *GetIamRoleArgs, opts ...InvokeOption) (*GetIamRoleResult, error)
func GetIamRoleOutput(ctx *Context, args *GetIamRoleOutputArgs, opts ...InvokeOption) GetIamRoleResultOutput

> Note: This function is named GetIamRole in the Go SDK.

public static class GetIamRole 
{
    public static Task<GetIamRoleResult> InvokeAsync(GetIamRoleArgs args, InvokeOptions? opts = null)
    public static Output<GetIamRoleResult> Invoke(GetIamRoleInvokeArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

Description string
RoleId string
Description string
RoleId string
description string
roleId string

getIamRole Result

The following output properties are available:

Id string
The provider-assigned unique ID for this managed resource.
RoleId string
Description string
Id string
The provider-assigned unique ID for this managed resource.
RoleId string
Description string
id string
The provider-assigned unique ID for this managed resource.
roleId string
description string
id str
The provider-assigned unique ID for this managed resource.
role_id str
description str

Package Details

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