1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. organizations
  5. IAMCustomRole
Google Cloud Classic v7.30.2 published on Wednesday, Jul 10, 2024 by Pulumi

gcp.organizations.IAMCustomRole

Explore with Pulumi AI

gcp logo
Google Cloud Classic v7.30.2 published on Wednesday, Jul 10, 2024 by Pulumi

    Allows management of a customized Cloud IAM organization role. For more information see the official documentation and API.

    Warning: Note that custom roles in GCP have the concept of a soft-delete. There are two issues that may arise from this and how roles are propagated. 1) creating a role may involve undeleting and then updating a role with the same name, possibly causing confusing behavior between undelete and update. 2) A deleted role is permanently deleted after 7 days, but it can take up to 30 more days (i.e. between 7 and 37 days after deletion) before the role name is made available again. This means a deleted role that has been deleted for more than 7 days cannot be changed at all by the provider, and new roles cannot share that name.

    Example Usage

    This snippet creates a customized IAM organization role.

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const my_custom_role = new gcp.organizations.IAMCustomRole("my-custom-role", {
        roleId: "myCustomRole",
        orgId: "123456789",
        title: "My Custom Role",
        description: "A description",
        permissions: [
            "iam.roles.list",
            "iam.roles.create",
            "iam.roles.delete",
        ],
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    my_custom_role = gcp.organizations.IAMCustomRole("my-custom-role",
        role_id="myCustomRole",
        org_id="123456789",
        title="My Custom Role",
        description="A description",
        permissions=[
            "iam.roles.list",
            "iam.roles.create",
            "iam.roles.delete",
        ])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := organizations.NewIAMCustomRole(ctx, "my-custom-role", &organizations.IAMCustomRoleArgs{
    			RoleId:      pulumi.String("myCustomRole"),
    			OrgId:       pulumi.String("123456789"),
    			Title:       pulumi.String("My Custom Role"),
    			Description: pulumi.String("A description"),
    			Permissions: pulumi.StringArray{
    				pulumi.String("iam.roles.list"),
    				pulumi.String("iam.roles.create"),
    				pulumi.String("iam.roles.delete"),
    			},
    		})
    		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 my_custom_role = new Gcp.Organizations.IAMCustomRole("my-custom-role", new()
        {
            RoleId = "myCustomRole",
            OrgId = "123456789",
            Title = "My Custom Role",
            Description = "A description",
            Permissions = new[]
            {
                "iam.roles.list",
                "iam.roles.create",
                "iam.roles.delete",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.organizations.IAMCustomRole;
    import com.pulumi.gcp.organizations.IAMCustomRoleArgs;
    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) {
            var my_custom_role = new IAMCustomRole("my-custom-role", IAMCustomRoleArgs.builder()
                .roleId("myCustomRole")
                .orgId("123456789")
                .title("My Custom Role")
                .description("A description")
                .permissions(            
                    "iam.roles.list",
                    "iam.roles.create",
                    "iam.roles.delete")
                .build());
    
        }
    }
    
    resources:
      my-custom-role:
        type: gcp:organizations:IAMCustomRole
        properties:
          roleId: myCustomRole
          orgId: '123456789'
          title: My Custom Role
          description: A description
          permissions:
            - iam.roles.list
            - iam.roles.create
            - iam.roles.delete
    

    Create IAMCustomRole Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new IAMCustomRole(name: string, args: IAMCustomRoleArgs, opts?: CustomResourceOptions);
    @overload
    def IAMCustomRole(resource_name: str,
                      args: IAMCustomRoleArgs,
                      opts: Optional[ResourceOptions] = None)
    
    @overload
    def IAMCustomRole(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      org_id: Optional[str] = None,
                      permissions: Optional[Sequence[str]] = None,
                      role_id: Optional[str] = None,
                      title: Optional[str] = None,
                      description: Optional[str] = None,
                      stage: Optional[str] = None)
    func NewIAMCustomRole(ctx *Context, name string, args IAMCustomRoleArgs, opts ...ResourceOption) (*IAMCustomRole, error)
    public IAMCustomRole(string name, IAMCustomRoleArgs args, CustomResourceOptions? opts = null)
    public IAMCustomRole(String name, IAMCustomRoleArgs args)
    public IAMCustomRole(String name, IAMCustomRoleArgs args, CustomResourceOptions options)
    
    type: gcp:organizations:IAMCustomRole
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args IAMCustomRoleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args IAMCustomRoleArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args IAMCustomRoleArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args IAMCustomRoleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args IAMCustomRoleArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var iamcustomRoleResource = new Gcp.Organizations.IAMCustomRole("iamcustomRoleResource", new()
    {
        OrgId = "string",
        Permissions = new[]
        {
            "string",
        },
        RoleId = "string",
        Title = "string",
        Description = "string",
        Stage = "string",
    });
    
    example, err := organizations.NewIAMCustomRole(ctx, "iamcustomRoleResource", &organizations.IAMCustomRoleArgs{
    	OrgId: pulumi.String("string"),
    	Permissions: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	RoleId:      pulumi.String("string"),
    	Title:       pulumi.String("string"),
    	Description: pulumi.String("string"),
    	Stage:       pulumi.String("string"),
    })
    
    var iamcustomRoleResource = new IAMCustomRole("iamcustomRoleResource", IAMCustomRoleArgs.builder()
        .orgId("string")
        .permissions("string")
        .roleId("string")
        .title("string")
        .description("string")
        .stage("string")
        .build());
    
    iamcustom_role_resource = gcp.organizations.IAMCustomRole("iamcustomRoleResource",
        org_id="string",
        permissions=["string"],
        role_id="string",
        title="string",
        description="string",
        stage="string")
    
    const iamcustomRoleResource = new gcp.organizations.IAMCustomRole("iamcustomRoleResource", {
        orgId: "string",
        permissions: ["string"],
        roleId: "string",
        title: "string",
        description: "string",
        stage: "string",
    });
    
    type: gcp:organizations:IAMCustomRole
    properties:
        description: string
        orgId: string
        permissions:
            - string
        roleId: string
        stage: string
        title: string
    

    IAMCustomRole Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The IAMCustomRole resource accepts the following input properties:

    OrgId string
    The numeric ID of the organization in which you want to create a custom role.
    Permissions List<string>
    The names of the permissions this role grants when bound in an IAM policy. At least one permission must be specified.
    RoleId string
    The role id to use for this role.
    Title string
    A human-readable title for the role.
    Description string
    A human-readable description for the role.
    Stage string
    The current launch stage of the role. Defaults to GA. List of possible stages is here.
    OrgId string
    The numeric ID of the organization in which you want to create a custom role.
    Permissions []string
    The names of the permissions this role grants when bound in an IAM policy. At least one permission must be specified.
    RoleId string
    The role id to use for this role.
    Title string
    A human-readable title for the role.
    Description string
    A human-readable description for the role.
    Stage string
    The current launch stage of the role. Defaults to GA. List of possible stages is here.
    orgId String
    The numeric ID of the organization in which you want to create a custom role.
    permissions List<String>
    The names of the permissions this role grants when bound in an IAM policy. At least one permission must be specified.
    roleId String
    The role id to use for this role.
    title String
    A human-readable title for the role.
    description String
    A human-readable description for the role.
    stage String
    The current launch stage of the role. Defaults to GA. List of possible stages is here.
    orgId string
    The numeric ID of the organization in which you want to create a custom role.
    permissions string[]
    The names of the permissions this role grants when bound in an IAM policy. At least one permission must be specified.
    roleId string
    The role id to use for this role.
    title string
    A human-readable title for the role.
    description string
    A human-readable description for the role.
    stage string
    The current launch stage of the role. Defaults to GA. List of possible stages is here.
    org_id str
    The numeric ID of the organization in which you want to create a custom role.
    permissions Sequence[str]
    The names of the permissions this role grants when bound in an IAM policy. At least one permission must be specified.
    role_id str
    The role id to use for this role.
    title str
    A human-readable title for the role.
    description str
    A human-readable description for the role.
    stage str
    The current launch stage of the role. Defaults to GA. List of possible stages is here.
    orgId String
    The numeric ID of the organization in which you want to create a custom role.
    permissions List<String>
    The names of the permissions this role grants when bound in an IAM policy. At least one permission must be specified.
    roleId String
    The role id to use for this role.
    title String
    A human-readable title for the role.
    description String
    A human-readable description for the role.
    stage String
    The current launch stage of the role. Defaults to GA. List of possible stages is here.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the IAMCustomRole resource produces the following output properties:

    Deleted bool
    (Optional) The current deleted state of the role.
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    The name of the role in the format organizations/{{org_id}}/roles/{{role_id}}. Like id, this field can be used as a reference in other resources such as IAM role bindings.
    Deleted bool
    (Optional) The current deleted state of the role.
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    The name of the role in the format organizations/{{org_id}}/roles/{{role_id}}. Like id, this field can be used as a reference in other resources such as IAM role bindings.
    deleted Boolean
    (Optional) The current deleted state of the role.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    The name of the role in the format organizations/{{org_id}}/roles/{{role_id}}. Like id, this field can be used as a reference in other resources such as IAM role bindings.
    deleted boolean
    (Optional) The current deleted state of the role.
    id string
    The provider-assigned unique ID for this managed resource.
    name string
    The name of the role in the format organizations/{{org_id}}/roles/{{role_id}}. Like id, this field can be used as a reference in other resources such as IAM role bindings.
    deleted bool
    (Optional) The current deleted state of the role.
    id str
    The provider-assigned unique ID for this managed resource.
    name str
    The name of the role in the format organizations/{{org_id}}/roles/{{role_id}}. Like id, this field can be used as a reference in other resources such as IAM role bindings.
    deleted Boolean
    (Optional) The current deleted state of the role.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    The name of the role in the format organizations/{{org_id}}/roles/{{role_id}}. Like id, this field can be used as a reference in other resources such as IAM role bindings.

    Look up Existing IAMCustomRole Resource

    Get an existing IAMCustomRole resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: IAMCustomRoleState, opts?: CustomResourceOptions): IAMCustomRole
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            deleted: Optional[bool] = None,
            description: Optional[str] = None,
            name: Optional[str] = None,
            org_id: Optional[str] = None,
            permissions: Optional[Sequence[str]] = None,
            role_id: Optional[str] = None,
            stage: Optional[str] = None,
            title: Optional[str] = None) -> IAMCustomRole
    func GetIAMCustomRole(ctx *Context, name string, id IDInput, state *IAMCustomRoleState, opts ...ResourceOption) (*IAMCustomRole, error)
    public static IAMCustomRole Get(string name, Input<string> id, IAMCustomRoleState? state, CustomResourceOptions? opts = null)
    public static IAMCustomRole get(String name, Output<String> id, IAMCustomRoleState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Deleted bool
    (Optional) The current deleted state of the role.
    Description string
    A human-readable description for the role.
    Name string
    The name of the role in the format organizations/{{org_id}}/roles/{{role_id}}. Like id, this field can be used as a reference in other resources such as IAM role bindings.
    OrgId string
    The numeric ID of the organization in which you want to create a custom role.
    Permissions List<string>
    The names of the permissions this role grants when bound in an IAM policy. At least one permission must be specified.
    RoleId string
    The role id to use for this role.
    Stage string
    The current launch stage of the role. Defaults to GA. List of possible stages is here.
    Title string
    A human-readable title for the role.
    Deleted bool
    (Optional) The current deleted state of the role.
    Description string
    A human-readable description for the role.
    Name string
    The name of the role in the format organizations/{{org_id}}/roles/{{role_id}}. Like id, this field can be used as a reference in other resources such as IAM role bindings.
    OrgId string
    The numeric ID of the organization in which you want to create a custom role.
    Permissions []string
    The names of the permissions this role grants when bound in an IAM policy. At least one permission must be specified.
    RoleId string
    The role id to use for this role.
    Stage string
    The current launch stage of the role. Defaults to GA. List of possible stages is here.
    Title string
    A human-readable title for the role.
    deleted Boolean
    (Optional) The current deleted state of the role.
    description String
    A human-readable description for the role.
    name String
    The name of the role in the format organizations/{{org_id}}/roles/{{role_id}}. Like id, this field can be used as a reference in other resources such as IAM role bindings.
    orgId String
    The numeric ID of the organization in which you want to create a custom role.
    permissions List<String>
    The names of the permissions this role grants when bound in an IAM policy. At least one permission must be specified.
    roleId String
    The role id to use for this role.
    stage String
    The current launch stage of the role. Defaults to GA. List of possible stages is here.
    title String
    A human-readable title for the role.
    deleted boolean
    (Optional) The current deleted state of the role.
    description string
    A human-readable description for the role.
    name string
    The name of the role in the format organizations/{{org_id}}/roles/{{role_id}}. Like id, this field can be used as a reference in other resources such as IAM role bindings.
    orgId string
    The numeric ID of the organization in which you want to create a custom role.
    permissions string[]
    The names of the permissions this role grants when bound in an IAM policy. At least one permission must be specified.
    roleId string
    The role id to use for this role.
    stage string
    The current launch stage of the role. Defaults to GA. List of possible stages is here.
    title string
    A human-readable title for the role.
    deleted bool
    (Optional) The current deleted state of the role.
    description str
    A human-readable description for the role.
    name str
    The name of the role in the format organizations/{{org_id}}/roles/{{role_id}}. Like id, this field can be used as a reference in other resources such as IAM role bindings.
    org_id str
    The numeric ID of the organization in which you want to create a custom role.
    permissions Sequence[str]
    The names of the permissions this role grants when bound in an IAM policy. At least one permission must be specified.
    role_id str
    The role id to use for this role.
    stage str
    The current launch stage of the role. Defaults to GA. List of possible stages is here.
    title str
    A human-readable title for the role.
    deleted Boolean
    (Optional) The current deleted state of the role.
    description String
    A human-readable description for the role.
    name String
    The name of the role in the format organizations/{{org_id}}/roles/{{role_id}}. Like id, this field can be used as a reference in other resources such as IAM role bindings.
    orgId String
    The numeric ID of the organization in which you want to create a custom role.
    permissions List<String>
    The names of the permissions this role grants when bound in an IAM policy. At least one permission must be specified.
    roleId String
    The role id to use for this role.
    stage String
    The current launch stage of the role. Defaults to GA. List of possible stages is here.
    title String
    A human-readable title for the role.

    Import

    Customized IAM organization role can be imported using their URI, e.g.

    $ pulumi import gcp:organizations/iAMCustomRole:IAMCustomRole my-custom-role organizations/123456789/roles/myCustomRole
    

    To learn more about importing existing cloud resources, see Importing resources.

    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 Classic v7.30.2 published on Wednesday, Jul 10, 2024 by Pulumi