@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
252 lines (251 loc) • 8.29 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
/**
* A database user in an AlloyDB cluster.
*
* To get more information about User, see:
*
* * [API documentation](https://cloud.google.com/alloydb/docs/reference/rest/v1/projects.locations.clusters.users/create)
* * How-to Guides
* * [AlloyDB](https://cloud.google.com/alloydb/docs/)
*
* ## Example Usage
*
* ### Alloydb User Builtin
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const defaultCluster = new gcp.alloydb.Cluster("default", {
* clusterId: "alloydb-cluster",
* location: "us-central1",
* networkConfig: {
* network: defaultGoogleComputeNetwork.id,
* },
* initialUser: {
* password: "cluster_secret",
* },
* });
* const defaultNetwork = new gcp.compute.Network("default", {name: "alloydb-network"});
* const privateIpAlloc = new gcp.compute.GlobalAddress("private_ip_alloc", {
* name: "alloydb-cluster",
* addressType: "INTERNAL",
* purpose: "VPC_PEERING",
* prefixLength: 16,
* network: defaultNetwork.id,
* });
* const vpcConnection = new gcp.servicenetworking.Connection("vpc_connection", {
* network: defaultNetwork.id,
* service: "servicenetworking.googleapis.com",
* reservedPeeringRanges: [privateIpAlloc.name],
* });
* const _default = new gcp.alloydb.Instance("default", {
* cluster: defaultCluster.name,
* instanceId: "alloydb-instance",
* instanceType: "PRIMARY",
* }, {
* dependsOn: [vpcConnection],
* });
* const project = gcp.organizations.getProject({});
* const user1 = new gcp.alloydb.User("user1", {
* cluster: defaultCluster.name,
* userId: "user1",
* userType: "ALLOYDB_BUILT_IN",
* password: "user_secret",
* databaseRoles: ["alloydbsuperuser"],
* }, {
* dependsOn: [_default],
* });
* ```
* ### Alloydb User Iam
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const defaultNetwork = new gcp.compute.Network("default", {name: "alloydb-network"});
* const defaultCluster = new gcp.alloydb.Cluster("default", {
* clusterId: "alloydb-cluster",
* location: "us-central1",
* networkConfig: {
* network: defaultNetwork.id,
* },
* initialUser: {
* password: "cluster_secret",
* },
* });
* const privateIpAlloc = new gcp.compute.GlobalAddress("private_ip_alloc", {
* name: "alloydb-cluster",
* addressType: "INTERNAL",
* purpose: "VPC_PEERING",
* prefixLength: 16,
* network: defaultNetwork.id,
* });
* const vpcConnection = new gcp.servicenetworking.Connection("vpc_connection", {
* network: defaultNetwork.id,
* service: "servicenetworking.googleapis.com",
* reservedPeeringRanges: [privateIpAlloc.name],
* });
* const _default = new gcp.alloydb.Instance("default", {
* cluster: defaultCluster.name,
* instanceId: "alloydb-instance",
* instanceType: "PRIMARY",
* }, {
* dependsOn: [vpcConnection],
* });
* const project = gcp.organizations.getProject({});
* const user2 = new gcp.alloydb.User("user2", {
* cluster: defaultCluster.name,
* userId: "user2@foo.com",
* userType: "ALLOYDB_IAM_USER",
* databaseRoles: ["alloydbiamuser"],
* }, {
* dependsOn: [_default],
* });
* ```
*
* ## Import
*
* User can be imported using any of these accepted formats:
*
* * `projects/{{project}}/locations/{{location}}/clusters/{{cluster}}/users/{{user_id}}`
*
* * `{{project}}/{{location}}/{{cluster}}/{{user_id}}`
*
* * `{{location}}/{{cluster}}/{{user_id}}`
*
* When using the `pulumi import` command, User can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:alloydb/user:User default projects/{{project}}/locations/{{location}}/clusters/{{cluster}}/users/{{user_id}}
* ```
*
* ```sh
* $ pulumi import gcp:alloydb/user:User default {{project}}/{{location}}/{{cluster}}/{{user_id}}
* ```
*
* ```sh
* $ pulumi import gcp:alloydb/user:User default {{location}}/{{cluster}}/{{user_id}}
* ```
*/
export declare 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: string, id: pulumi.Input<pulumi.ID>, state?: UserState, opts?: pulumi.CustomResourceOptions): 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: any): obj is User;
/**
* Identifies the alloydb cluster. Must be in the format
* 'projects/{project}/locations/{location}/clusters/{cluster_id}'
*/
readonly cluster: pulumi.Output<string>;
/**
* List of database roles this database user has.
*/
readonly databaseRoles: pulumi.Output<string[] | undefined>;
/**
* Name of the resource in the form of projects/{project}/locations/{location}/clusters/{cluster}/users/{user}.
*/
readonly name: pulumi.Output<string>;
/**
* Password for this database user.
* **Note**: This property is sensitive and will not be displayed in the plan.
*/
readonly password: pulumi.Output<string | undefined>;
/**
* The database role name of the user.
*/
readonly userId: pulumi.Output<string>;
/**
* The type of this user.
* Possible values are: `ALLOYDB_BUILT_IN`, `ALLOYDB_IAM_USER`.
*
*
* - - -
*/
readonly userType: pulumi.Output<string>;
/**
* Create a User 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: UserArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering User resources.
*/
export interface UserState {
/**
* Identifies the alloydb cluster. Must be in the format
* 'projects/{project}/locations/{location}/clusters/{cluster_id}'
*/
cluster?: pulumi.Input<string>;
/**
* List of database roles this database user has.
*/
databaseRoles?: pulumi.Input<pulumi.Input<string>[]>;
/**
* Name of the resource in the form of projects/{project}/locations/{location}/clusters/{cluster}/users/{user}.
*/
name?: pulumi.Input<string>;
/**
* Password for this database user.
* **Note**: This property is sensitive and will not be displayed in the plan.
*/
password?: pulumi.Input<string>;
/**
* The database role name of the user.
*/
userId?: pulumi.Input<string>;
/**
* The type of this user.
* Possible values are: `ALLOYDB_BUILT_IN`, `ALLOYDB_IAM_USER`.
*
*
* - - -
*/
userType?: pulumi.Input<string>;
}
/**
* The set of arguments for constructing a User resource.
*/
export interface UserArgs {
/**
* Identifies the alloydb cluster. Must be in the format
* 'projects/{project}/locations/{location}/clusters/{cluster_id}'
*/
cluster: pulumi.Input<string>;
/**
* List of database roles this database user has.
*/
databaseRoles?: pulumi.Input<pulumi.Input<string>[]>;
/**
* Password for this database user.
* **Note**: This property is sensitive and will not be displayed in the plan.
*/
password?: pulumi.Input<string>;
/**
* The database role name of the user.
*/
userId: pulumi.Input<string>;
/**
* The type of this user.
* Possible values are: `ALLOYDB_BUILT_IN`, `ALLOYDB_IAM_USER`.
*
*
* - - -
*/
userType: pulumi.Input<string>;
}