@pulumiverse/scaleway
Version:
A Pulumi package for creating and managing Scaleway cloud resources.
143 lines • 6.04 kB
JavaScript
;
// *** 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"));
/**
* The `scaleway.databases.User` resource creates and manages database users.
* For more information, see the [API documentation](https://www.scaleway.com/en/developers/api/managed-database-postgre-mysql/).
*
* > **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 random from "@pulumi/random";
* import * as scaleway from "@pulumiverse/scaleway";
*
* //## Basic user creation
* const main = new scaleway.databases.Instance("main", {
* name: "test-rdb",
* nodeType: "DB-DEV-S",
* engine: "PostgreSQL-15",
* isHaCluster: true,
* disableBackup: true,
* userName: "my_initial_user",
* password: "thiZ_is_v&ry_s3cret",
* });
* const dbPassword = new random.index.Password("db_password", {
* length: 20,
* special: true,
* upper: true,
* lower: true,
* numeric: true,
* minUpper: 1,
* minLower: 1,
* minNumeric: 1,
* minSpecial: 1,
* overrideSpecial: "!@#$%^&*()_+-=[]{}|;:,.<>?",
* });
* const dbAdmin = new scaleway.databases.User("db_admin", {
* instanceId: main.id,
* name: "devtools",
* password: dbPassword.result,
* isAdmin: true,
* });
* ```
*
* ## Import
*
* Database users can be imported using `{region}/{instance_id}/{user_name}`, e.g.
*
* ```sh
* $ pulumi import scaleway:databases/user:User admin fr-par/11111111-1111-1111-1111-111111111111/admin
* ```
*/
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:databases/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["instanceId"] = state?.instanceId;
resourceInputs["isAdmin"] = state?.isAdmin;
resourceInputs["name"] = state?.name;
resourceInputs["password"] = state?.password;
resourceInputs["passwordWo"] = state?.passwordWo;
resourceInputs["passwordWoVersion"] = state?.passwordWoVersion;
resourceInputs["region"] = state?.region;
}
else {
const args = argsOrState;
if (args?.instanceId === undefined && !opts.urn) {
throw new Error("Missing required property 'instanceId'");
}
resourceInputs["instanceId"] = args?.instanceId;
resourceInputs["isAdmin"] = args?.isAdmin;
resourceInputs["name"] = args?.name;
resourceInputs["password"] = args?.password ? pulumi.secret(args.password) : undefined;
resourceInputs["passwordWo"] = args?.passwordWo ? pulumi.secret(args.passwordWo) : undefined;
resourceInputs["passwordWoVersion"] = args?.passwordWoVersion;
resourceInputs["region"] = args?.region;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const aliasOpts = { aliases: [{ type: "scaleway:index/databaseUser:DatabaseUser" }] };
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