UNPKG

@pulumiverse/scaleway

Version:

A Pulumi package for creating and managing Scaleway cloud resources.

179 lines 8 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.User = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("../utilities")); /** * Creates and manages Scaleway IAM [Users](https://www.scaleway.com/en/docs/iam/concepts/#member). * * For more information, see the [API documentation](https://www.scaleway.com/en/developers/api/iam/#path-users-list-users-of-an-organization). * * > **Security Best Practice:** * For enhanced security, we recommend using the `passwordWo` write-only argument instead of the regular `password` argument. This ensures your sensitive credentials are never stored in Terraform state files, providing superior protection against accidental exposure. Write-Only arguments are supported in Terraform 1.11.0 and later. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as scaleway from "@pulumiverse/scaleway"; * * //## Basic IAM user creation * const user = new scaleway.iam.User("user", { * email: "foo@test.com", * tags: ["test-tag"], * username: "foo", * firstName: "Foo", * lastName: "Bar", * }); * ``` * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as scaleway from "@pulumiverse/scaleway"; * * const users = [ * { * email: "test@test.com", * username: "test", * }, * { * email: "test2@test.com", * username: "test2", * }, * ]; * const usersUser: scaleway.iam.User[] = []; * for (const range = {value: 0}; range.value < users.length; range.value++) { * usersUser.push(new scaleway.iam.User(`users-${range.value}`, { * email: users[range.value].email, * username: users[range.value].username, * })); * } * ``` * * ## Import * * IAM users can be imported using the `{id}`, e.g. * * ```sh * $ pulumi import scaleway:iam/user:User basic 11111111-1111-1111-1111-111111111111 * ``` */ class User extends pulumi.CustomResource { /** * Get an existing User 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, id, state, opts) { return new User(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'scaleway:iam/user:User'; /** * Returns true if the given object is an instance of User. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === User.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["accountRootUserId"] = state?.accountRootUserId; resourceInputs["createdAt"] = state?.createdAt; resourceInputs["deletable"] = state?.deletable; resourceInputs["email"] = state?.email; resourceInputs["firstName"] = state?.firstName; resourceInputs["lastLoginAt"] = state?.lastLoginAt; resourceInputs["lastName"] = state?.lastName; resourceInputs["locale"] = state?.locale; resourceInputs["locked"] = state?.locked; resourceInputs["mfa"] = state?.mfa; resourceInputs["organizationId"] = state?.organizationId; resourceInputs["password"] = state?.password; resourceInputs["passwordWo"] = state?.passwordWo; resourceInputs["passwordWoVersion"] = state?.passwordWoVersion; resourceInputs["phoneNumber"] = state?.phoneNumber; resourceInputs["sendPasswordEmail"] = state?.sendPasswordEmail; resourceInputs["sendWelcomeEmail"] = state?.sendWelcomeEmail; resourceInputs["status"] = state?.status; resourceInputs["tags"] = state?.tags; resourceInputs["type"] = state?.type; resourceInputs["updatedAt"] = state?.updatedAt; resourceInputs["username"] = state?.username; } else { const args = argsOrState; if (args?.email === undefined && !opts.urn) { throw new Error("Missing required property 'email'"); } if (args?.username === undefined && !opts.urn) { throw new Error("Missing required property 'username'"); } resourceInputs["email"] = args?.email; resourceInputs["firstName"] = args?.firstName; resourceInputs["lastName"] = args?.lastName; resourceInputs["locale"] = args?.locale; resourceInputs["organizationId"] = args?.organizationId; resourceInputs["password"] = args?.password ? pulumi.secret(args.password) : undefined; resourceInputs["passwordWo"] = args?.passwordWo ? pulumi.secret(args.passwordWo) : undefined; resourceInputs["passwordWoVersion"] = args?.passwordWoVersion; resourceInputs["phoneNumber"] = args?.phoneNumber; resourceInputs["sendPasswordEmail"] = args?.sendPasswordEmail; resourceInputs["sendWelcomeEmail"] = args?.sendWelcomeEmail; resourceInputs["tags"] = args?.tags; resourceInputs["username"] = args?.username; resourceInputs["accountRootUserId"] = undefined /*out*/; resourceInputs["createdAt"] = undefined /*out*/; resourceInputs["deletable"] = undefined /*out*/; resourceInputs["lastLoginAt"] = undefined /*out*/; resourceInputs["locked"] = undefined /*out*/; resourceInputs["mfa"] = undefined /*out*/; resourceInputs["status"] = undefined /*out*/; resourceInputs["type"] = undefined /*out*/; resourceInputs["updatedAt"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const aliasOpts = { aliases: [{ type: "scaleway:index/iamUser:IamUser" }] }; opts = pulumi.mergeOptions(opts, aliasOpts); const secretOpts = { additionalSecretOutputs: ["password", "passwordWo"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(User.__pulumiType, name, resourceInputs, opts); } } exports.User = User; //# sourceMappingURL=user.js.map