Google Cloud v8.27.0 published on Thursday, Apr 17, 2025 by Pulumi
gcp.organizations.getIamCustomRole
Explore with Pulumi AI
Get information about a Google Cloud Organization IAM Custom Role. Note that you must have the roles/iam.organizationRoleViewer role (or equivalent permissions) at the organization level to use this datasource.
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const example = gcp.organizations.getIamCustomRole({
    orgId: "1234567890",
    roleId: "your-role-id",
});
const project = new gcp.projects.IAMMember("project", {
    project: "your-project-id",
    role: example.then(example => example.name),
    member: "user:jane@example.com",
});
import pulumi
import pulumi_gcp as gcp
example = gcp.organizations.get_iam_custom_role(org_id="1234567890",
    role_id="your-role-id")
project = gcp.projects.IAMMember("project",
    project="your-project-id",
    role=example.name,
    member="user:jane@example.com")
package main
import (
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/organizations"
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/projects"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := organizations.GetIamCustomRole(ctx, &organizations.GetIamCustomRoleArgs{
			OrgId:  "1234567890",
			RoleId: "your-role-id",
		}, nil)
		if err != nil {
			return err
		}
		_, err = projects.NewIAMMember(ctx, "project", &projects.IAMMemberArgs{
			Project: pulumi.String("your-project-id"),
			Role:    pulumi.String(example.Name),
			Member:  pulumi.String("user:jane@example.com"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() => 
{
    var example = Gcp.Organizations.GetIamCustomRole.Invoke(new()
    {
        OrgId = "1234567890",
        RoleId = "your-role-id",
    });
    var project = new Gcp.Projects.IAMMember("project", new()
    {
        Project = "your-project-id",
        Role = example.Apply(getIamCustomRoleResult => getIamCustomRoleResult.Name),
        Member = "user:jane@example.com",
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.organizations.OrganizationsFunctions;
import com.pulumi.gcp.organizations.inputs.GetIamCustomRoleArgs;
import com.pulumi.gcp.projects.IAMMember;
import com.pulumi.gcp.projects.IAMMemberArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }
    public static void stack(Context ctx) {
        final var example = OrganizationsFunctions.getIamCustomRole(GetIamCustomRoleArgs.builder()
            .orgId("1234567890")
            .roleId("your-role-id")
            .build());
        var project = new IAMMember("project", IAMMemberArgs.builder()
            .project("your-project-id")
            .role(example.name())
            .member("user:jane@example.com")
            .build());
    }
}
resources:
  project:
    type: gcp:projects:IAMMember
    properties:
      project: your-project-id
      role: ${example.name}
      member: user:jane@example.com
variables:
  example:
    fn::invoke:
      function: gcp:organizations:getIamCustomRole
      arguments:
        orgId: '1234567890'
        roleId: your-role-id
Using getIamCustomRole
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 getIamCustomRole(args: GetIamCustomRoleArgs, opts?: InvokeOptions): Promise<GetIamCustomRoleResult>
function getIamCustomRoleOutput(args: GetIamCustomRoleOutputArgs, opts?: InvokeOptions): Output<GetIamCustomRoleResult>def get_iam_custom_role(org_id: Optional[str] = None,
                        role_id: Optional[str] = None,
                        opts: Optional[InvokeOptions] = None) -> GetIamCustomRoleResult
def get_iam_custom_role_output(org_id: Optional[pulumi.Input[str]] = None,
                        role_id: Optional[pulumi.Input[str]] = None,
                        opts: Optional[InvokeOptions] = None) -> Output[GetIamCustomRoleResult]func GetIamCustomRole(ctx *Context, args *GetIamCustomRoleArgs, opts ...InvokeOption) (*GetIamCustomRoleResult, error)
func GetIamCustomRoleOutput(ctx *Context, args *GetIamCustomRoleOutputArgs, opts ...InvokeOption) GetIamCustomRoleResultOutput> Note: This function is named GetIamCustomRole in the Go SDK.
public static class GetIamCustomRole 
{
    public static Task<GetIamCustomRoleResult> InvokeAsync(GetIamCustomRoleArgs args, InvokeOptions? opts = null)
    public static Output<GetIamCustomRoleResult> Invoke(GetIamCustomRoleInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetIamCustomRoleResult> getIamCustomRole(GetIamCustomRoleArgs args, InvokeOptions options)
public static Output<GetIamCustomRoleResult> getIamCustomRole(GetIamCustomRoleArgs args, InvokeOptions options)
fn::invoke:
  function: gcp:organizations/getIamCustomRole:getIamCustomRole
  arguments:
    # arguments dictionaryThe following arguments are supported:
getIamCustomRole Result
The following output properties are available:
- Deleted bool
 - Description string
 - Id string
 - The provider-assigned unique ID for this managed resource.
 - Name string
 - Org
Id string - Permissions List<string>
 - Role
Id string - Stage string
 - Title string
 
- Deleted bool
 - Description string
 - Id string
 - The provider-assigned unique ID for this managed resource.
 - Name string
 - Org
Id string - Permissions []string
 - Role
Id string - Stage string
 - Title string
 
- deleted Boolean
 - description String
 - id String
 - The provider-assigned unique ID for this managed resource.
 - name String
 - org
Id String - permissions List<String>
 - role
Id String - stage String
 - title String
 
- deleted boolean
 - description string
 - id string
 - The provider-assigned unique ID for this managed resource.
 - name string
 - org
Id string - permissions string[]
 - role
Id string - stage string
 - title string
 
- deleted bool
 - description str
 - id str
 - The provider-assigned unique ID for this managed resource.
 - name str
 - org_
id str - permissions Sequence[str]
 - role_
id str - stage str
 - title str
 
- deleted Boolean
 - description String
 - id String
 - The provider-assigned unique ID for this managed resource.
 - name String
 - org
Id String - permissions List<String>
 - role
Id String - stage String
 - title String
 
Package Details
- Repository
 - Google Cloud (GCP) Classic pulumi/pulumi-gcp
 - License
 - Apache-2.0
 - Notes
 - This Pulumi package is based on the 
google-betaTerraform Provider.