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/) * * > **Note:** All arguments marked as write-only values will not be stored in the state: `passwordWo`. * Read more about Write-only Arguments. * * ## 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", * }, * deletionProtection: false, * }); * 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", * }, * deletionProtection: false, * }); * 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}} * $ pulumi import gcp:alloydb/user:User default {{project}}/{{location}}/{{cluster}}/{{user_id}} * $ 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, 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; /** * List of database roles this database user has. */ readonly databaseRoles: pulumi.Output; /** * Name of the resource in the form of projects/{project}/locations/{location}/clusters/{cluster}/users/{user}. */ readonly name: pulumi.Output; /** * Password for this database user. * **Note**: This property is sensitive and will not be displayed in the plan. */ readonly password: pulumi.Output; /** * **NOTE:** This field is write-only and its value will not be updated in state as part of read operations. * (Optional, Write-Only) * Password for this database user. * **Note**: This property is write-only and will not be read from the API. * * > **Note:** One of `password` or `passwordWo` can only be set. */ readonly passwordWo: pulumi.Output; /** * Triggers update of `passwordWo` write-only. Increment this value when an update to `passwordWo` is needed. For more info see [updating write-only arguments](https://www.terraform.io/docs/providers/google/guides/using_write_only_arguments.html#updating-write-only-arguments) */ readonly passwordWoVersion: pulumi.Output; /** * The database role name of the user. */ readonly userId: pulumi.Output; /** * The type of this user. * Possible values are: `ALLOYDB_BUILT_IN`, `ALLOYDB_IAM_USER`. */ readonly userType: pulumi.Output; /** * 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; /** * List of database roles this database user has. */ databaseRoles?: pulumi.Input[]>; /** * Name of the resource in the form of projects/{project}/locations/{location}/clusters/{cluster}/users/{user}. */ name?: pulumi.Input; /** * Password for this database user. * **Note**: This property is sensitive and will not be displayed in the plan. */ password?: pulumi.Input; /** * **NOTE:** This field is write-only and its value will not be updated in state as part of read operations. * (Optional, Write-Only) * Password for this database user. * **Note**: This property is write-only and will not be read from the API. * * > **Note:** One of `password` or `passwordWo` can only be set. */ passwordWo?: pulumi.Input; /** * Triggers update of `passwordWo` write-only. Increment this value when an update to `passwordWo` is needed. For more info see [updating write-only arguments](https://www.terraform.io/docs/providers/google/guides/using_write_only_arguments.html#updating-write-only-arguments) */ passwordWoVersion?: pulumi.Input; /** * The database role name of the user. */ userId?: pulumi.Input; /** * The type of this user. * Possible values are: `ALLOYDB_BUILT_IN`, `ALLOYDB_IAM_USER`. */ userType?: pulumi.Input; } /** * 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; /** * List of database roles this database user has. */ databaseRoles?: pulumi.Input[]>; /** * Password for this database user. * **Note**: This property is sensitive and will not be displayed in the plan. */ password?: pulumi.Input; /** * **NOTE:** This field is write-only and its value will not be updated in state as part of read operations. * (Optional, Write-Only) * Password for this database user. * **Note**: This property is write-only and will not be read from the API. * * > **Note:** One of `password` or `passwordWo` can only be set. */ passwordWo?: pulumi.Input; /** * Triggers update of `passwordWo` write-only. Increment this value when an update to `passwordWo` is needed. For more info see [updating write-only arguments](https://www.terraform.io/docs/providers/google/guides/using_write_only_arguments.html#updating-write-only-arguments) */ passwordWoVersion?: pulumi.Input; /** * The database role name of the user. */ userId: pulumi.Input; /** * The type of this user. * Possible values are: `ALLOYDB_BUILT_IN`, `ALLOYDB_IAM_USER`. */ userType: pulumi.Input; }