1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. organizations
  5. getIamCustomRole
Google Cloud v9.4.0 published on Tuesday, Nov 4, 2025 by Pulumi

gcp.organizations.getIamCustomRole

Start a Neo task
Explain and create a gcp.organizations.getIamCustomRole resource
gcp logo
Google Cloud v9.4.0 published on Tuesday, Nov 4, 2025 by Pulumi

    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/v9/go/gcp/organizations"
    	"github.com/pulumi/pulumi-gcp/sdk/v9/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 dictionary

    The following arguments are supported:

    OrgId string
    The numeric ID of the organization in which you want to create a custom role.
    RoleId string
    The role id that has been used for this role.
    OrgId string
    The numeric ID of the organization in which you want to create a custom role.
    RoleId string
    The role id that has been used for this role.
    orgId String
    The numeric ID of the organization in which you want to create a custom role.
    roleId String
    The role id that has been used for this role.
    orgId string
    The numeric ID of the organization in which you want to create a custom role.
    roleId string
    The role id that has been used for this role.
    org_id str
    The numeric ID of the organization in which you want to create a custom role.
    role_id str
    The role id that has been used for this role.
    orgId String
    The numeric ID of the organization in which you want to create a custom role.
    roleId String
    The role id that has been used for this role.

    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
    OrgId string
    Permissions List<string>
    RoleId string
    Stage string
    Title string
    Deleted bool
    Description string
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    OrgId string
    Permissions []string
    RoleId string
    Stage string
    Title string
    deleted Boolean
    description String
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    orgId String
    permissions List<String>
    roleId String
    stage String
    title String
    deleted boolean
    description string
    id string
    The provider-assigned unique ID for this managed resource.
    name string
    orgId string
    permissions string[]
    roleId 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
    orgId String
    permissions List<String>
    roleId 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-beta Terraform Provider.
    gcp logo
    Google Cloud v9.4.0 published on Tuesday, Nov 4, 2025 by Pulumi
      Meet Neo: Your AI Platform Teammate