UNPKG

@huaweicloudos/pulumi

Version:

A Pulumi package for creating and managing Huaweicloud cloud resources.

230 lines (229 loc) 8.35 kB
import * as pulumi from "@pulumi/pulumi"; /** * Manages an IAM user group role assignment within HuaweiCloud IAM Service. * This is an alternative to `huaweicloud.Iam.RoleAssignment` * * > **NOTE:** 1. You *must* have admin privileges to use this resource. * <br/>2. When the resource is created, the permissions will take effect after 15 to 30 minutes. * * ## Example Usage * ### Assign role with project * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as huaweicloud from "@pulumi/huaweicloud"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const projectId = config.requireObject("projectId"); * const testRole = huaweicloud.Iam.getRole({ * name: "rds_adm", * }); * const testGroup = new huaweicloud.iam.Group("testGroup", {}); * const testGroupRoleAssignment = new huaweicloud.iam.GroupRoleAssignment("testGroupRoleAssignment", { * groupId: testGroup.id, * roleId: testRole.then(testRole => testRole.id), * projectId: projectId, * }); * ``` * ### Assign role with all projects * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as huaweicloud from "@pulumi/huaweicloud"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const projectId = config.requireObject("projectId"); * const testRole = huaweicloud.Iam.getRole({ * name: "rds_adm", * }); * const testGroup = new huaweicloud.iam.Group("testGroup", {}); * const all = new huaweicloud.iam.GroupRoleAssignment("all", { * groupId: testGroup.id, * roleId: testRole.then(testRole => testRole.id), * projectId: "all", * }); * ``` * ### Assign role with domain * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as huaweicloud from "@pulumi/huaweicloud"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const domainId = config.requireObject("domainId"); * const testRole = huaweicloud.Iam.getRole({ * name: "obs_adm", * }); * const testGroup = new huaweicloud.iam.Group("testGroup", {}); * const testGroupRoleAssignment = new huaweicloud.iam.GroupRoleAssignment("testGroupRoleAssignment", { * groupId: testGroup.id, * roleId: testRole.then(testRole => testRole.id), * domainId: domainId, * }); * ``` * ### Assign role with enterprise project * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as huaweicloud from "@pulumi/huaweicloud"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const enterpriseProjectId = config.requireObject("enterpriseProjectId"); * const testRole = huaweicloud.Iam.getRole({ * name: "rds_adm", * }); * const testGroup = new huaweicloud.iam.Group("testGroup", {}); * const testGroupRoleAssignment = new huaweicloud.iam.GroupRoleAssignment("testGroupRoleAssignment", { * groupId: testGroup.id, * roleId: testRole.then(testRole => testRole.id), * enterpriseProjectId: enterpriseProjectId, * }); * ``` * * ## Import * * The role assignments can be imported using the `group_id`, `role_id` and * * `domain_id`, `project_id`, * * `enterprise_project_id`, e.g. bash * * ```sh * $ pulumi import huaweicloud:Iam/groupRoleAssignment:GroupRoleAssignment test <group_id>/<role_id>/<domain_id> * ``` * * or bash * * ```sh * $ pulumi import huaweicloud:Iam/groupRoleAssignment:GroupRoleAssignment test <group_id>/<role_id>/<project_id> * ``` * * or bash * * ```sh * $ pulumi import huaweicloud:Iam/groupRoleAssignment:GroupRoleAssignment test <group_id>/<role_id>/all * ``` * * or bash * * ```sh * $ pulumi import huaweicloud:Iam/groupRoleAssignment:GroupRoleAssignment test <group_id>/<role_id>/<enterprise_project_id> * ``` */ export declare class GroupRoleAssignment extends pulumi.CustomResource { /** * Get an existing GroupRoleAssignment 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?: GroupRoleAssignmentState, opts?: pulumi.CustomResourceOptions): GroupRoleAssignment; /** * Returns true if the given object is an instance of GroupRoleAssignment. 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 GroupRoleAssignment; /** * Specifies the domain to assign the role in. * Changing this parameter will create a new resource. */ readonly domainId: pulumi.Output<string | undefined>; /** * Specifies the enterprise project to assign the role in. * Changing this parameter will create a new resource. */ readonly enterpriseProjectId: pulumi.Output<string | undefined>; /** * Specifies the group to assign the role to. * Changing this parameter will create a new resource. */ readonly groupId: pulumi.Output<string>; /** * Specifies the project to assign the role in. * If `projectId` is set to **all**, it means that the specified user group will be able to use all projects, * including existing and future projects. */ readonly projectId: pulumi.Output<string | undefined>; /** * Specifies the role to assign. * Changing this parameter will create a new resource. */ readonly roleId: pulumi.Output<string>; /** * Create a GroupRoleAssignment 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: GroupRoleAssignmentArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering GroupRoleAssignment resources. */ export interface GroupRoleAssignmentState { /** * Specifies the domain to assign the role in. * Changing this parameter will create a new resource. */ domainId?: pulumi.Input<string>; /** * Specifies the enterprise project to assign the role in. * Changing this parameter will create a new resource. */ enterpriseProjectId?: pulumi.Input<string>; /** * Specifies the group to assign the role to. * Changing this parameter will create a new resource. */ groupId?: pulumi.Input<string>; /** * Specifies the project to assign the role in. * If `projectId` is set to **all**, it means that the specified user group will be able to use all projects, * including existing and future projects. */ projectId?: pulumi.Input<string>; /** * Specifies the role to assign. * Changing this parameter will create a new resource. */ roleId?: pulumi.Input<string>; } /** * The set of arguments for constructing a GroupRoleAssignment resource. */ export interface GroupRoleAssignmentArgs { /** * Specifies the domain to assign the role in. * Changing this parameter will create a new resource. */ domainId?: pulumi.Input<string>; /** * Specifies the enterprise project to assign the role in. * Changing this parameter will create a new resource. */ enterpriseProjectId?: pulumi.Input<string>; /** * Specifies the group to assign the role to. * Changing this parameter will create a new resource. */ groupId: pulumi.Input<string>; /** * Specifies the project to assign the role in. * If `projectId` is set to **all**, it means that the specified user group will be able to use all projects, * including existing and future projects. */ projectId?: pulumi.Input<string>; /** * Specifies the role to assign. * Changing this parameter will create a new resource. */ roleId: pulumi.Input<string>; }