UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

191 lines (190 loc) 7.29 kB
import * as pulumi from "@pulumi/pulumi"; /** * Allows management of a customized Cloud IAM project role. For more information see * [the official documentation](https://cloud.google.com/iam/docs/understanding-custom-roles) * and * [API](https://cloud.google.com/iam/reference/rest/v1/projects.roles). * * > **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 role. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const my_custom_role = new gcp.projects.IAMCustomRole("my-custom-role", { * roleId: "myCustomRole", * title: "My Custom Role", * description: "A description", * permissions: [ * "iam.roles.list", * "iam.roles.create", * "iam.roles.delete", * ], * }); * ``` * * ## Import * * Custom Roles can be imported using any of these accepted formats: * * * `projects/{{project}}/roles/{{role_id}}` * * * `{{project}}/{{role_id}}` * * * `{{role_id}}` * * When using the `pulumi import` command, Custom Roles can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:projects/iAMCustomRole:IAMCustomRole default projects/{{project}}/roles/{{role_id}} * ``` * * ```sh * $ pulumi import gcp:projects/iAMCustomRole:IAMCustomRole default {{project}}/{{role_id}} * ``` * * ```sh * $ pulumi import gcp:projects/iAMCustomRole:IAMCustomRole default {{role_id}} * ``` */ export declare class IAMCustomRole extends pulumi.CustomResource { /** * Get an existing IAMCustomRole resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input<pulumi.ID>, state?: IAMCustomRoleState, opts?: pulumi.CustomResourceOptions): IAMCustomRole; /** * Returns true if the given object is an instance of IAMCustomRole. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is IAMCustomRole; /** * (Optional) The current deleted state of the role. */ readonly deleted: pulumi.Output<boolean>; /** * A human-readable description for the role. */ readonly description: pulumi.Output<string | undefined>; /** * The name of the role in the format `projects/{{project}}/roles/{{role_id}}`. Like `id`, this field can be used as a reference in other resources such as IAM role bindings. */ readonly name: pulumi.Output<string>; /** * The names of the permissions this role grants when bound in an IAM policy. At least one permission must be specified. */ readonly permissions: pulumi.Output<string[]>; /** * The project that the custom role will be created in. * Defaults to the provider project configuration. */ readonly project: pulumi.Output<string>; /** * The camel case role id to use for this role. Cannot contain `-` characters. */ readonly roleId: pulumi.Output<string>; /** * The current launch stage of the role. * Defaults to `GA`. * List of possible stages is [here](https://cloud.google.com/iam/reference/rest/v1/organizations.roles#Role.RoleLaunchStage). */ readonly stage: pulumi.Output<string | undefined>; /** * A human-readable title for the role. */ readonly title: pulumi.Output<string>; /** * Create a IAMCustomRole resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: IAMCustomRoleArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering IAMCustomRole resources. */ export interface IAMCustomRoleState { /** * (Optional) The current deleted state of the role. */ deleted?: pulumi.Input<boolean>; /** * A human-readable description for the role. */ description?: pulumi.Input<string>; /** * The name of the role in the format `projects/{{project}}/roles/{{role_id}}`. Like `id`, this field can be used as a reference in other resources such as IAM role bindings. */ name?: pulumi.Input<string>; /** * The names of the permissions this role grants when bound in an IAM policy. At least one permission must be specified. */ permissions?: pulumi.Input<pulumi.Input<string>[]>; /** * The project that the custom role will be created in. * Defaults to the provider project configuration. */ project?: pulumi.Input<string>; /** * The camel case role id to use for this role. Cannot contain `-` characters. */ roleId?: pulumi.Input<string>; /** * The current launch stage of the role. * Defaults to `GA`. * List of possible stages is [here](https://cloud.google.com/iam/reference/rest/v1/organizations.roles#Role.RoleLaunchStage). */ stage?: pulumi.Input<string>; /** * A human-readable title for the role. */ title?: pulumi.Input<string>; } /** * The set of arguments for constructing a IAMCustomRole resource. */ export interface IAMCustomRoleArgs { /** * A human-readable description for the role. */ description?: pulumi.Input<string>; /** * The names of the permissions this role grants when bound in an IAM policy. At least one permission must be specified. */ permissions: pulumi.Input<pulumi.Input<string>[]>; /** * The project that the custom role will be created in. * Defaults to the provider project configuration. */ project?: pulumi.Input<string>; /** * The camel case role id to use for this role. Cannot contain `-` characters. */ roleId?: pulumi.Input<string>; /** * The current launch stage of the role. * Defaults to `GA`. * List of possible stages is [here](https://cloud.google.com/iam/reference/rest/v1/organizations.roles#Role.RoleLaunchStage). */ stage?: pulumi.Input<string>; /** * A human-readable title for the role. */ title: pulumi.Input<string>; }