UserArgs

data class UserArgs(val deletionPolicy: Output<String>? = null, val host: Output<String>? = null, val instance: Output<String>? = null, val name: Output<String>? = null, val password: Output<String>? = null, val passwordPolicy: Output<UserPasswordPolicyArgs>? = null, val project: Output<String>? = null, val type: Output<String>? = null) : ConvertibleToJava<UserArgs>

Example Usage

Example creating a SQL User.

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.random.RandomId;
import com.pulumi.random.RandomIdArgs;
import com.pulumi.gcp.sql.DatabaseInstance;
import com.pulumi.gcp.sql.DatabaseInstanceArgs;
import com.pulumi.gcp.sql.inputs.DatabaseInstanceSettingsArgs;
import com.pulumi.gcp.sql.User;
import com.pulumi.gcp.sql.UserArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var dbNameSuffix = new RandomId("dbNameSuffix", RandomIdArgs.builder()
.byteLength(4)
.build());
var main = new DatabaseInstance("main", DatabaseInstanceArgs.builder()
.databaseVersion("MYSQL_5_7")
.settings(DatabaseInstanceSettingsArgs.builder()
.tier("db-f1-micro")
.build())
.build());
var users = new User("users", UserArgs.builder()
.instance(main.name())
.host("me.com")
.password("changeme")
.build());
}
}

Import

SQL users for MySQL databases can be imported using the project, instance, host and name, e.g.

$ pulumi import gcp:sql/user:User users my-project/main-instance/my-domain.com/me

SQL users for PostgreSQL databases can be imported using the project, instance and name, e.g.

$ pulumi import gcp:sql/user:User users my-project/main-instance/me

Constructors

Link copied to clipboard
fun UserArgs(deletionPolicy: Output<String>? = null, host: Output<String>? = null, instance: Output<String>? = null, name: Output<String>? = null, password: Output<String>? = null, passwordPolicy: Output<UserPasswordPolicyArgs>? = null, project: Output<String>? = null, type: Output<String>? = null)

Functions

Link copied to clipboard
open override fun toJava(): UserArgs

Properties

Link copied to clipboard
val deletionPolicy: Output<String>? = null

The deletion policy for the user. Setting ABANDON allows the resource to be abandoned rather than deleted. This is useful for Postgres, where users cannot be deleted from the API if they have been granted SQL roles.

Link copied to clipboard
val host: Output<String>? = null

The host the user can connect from. This is only supported for BUILT_IN users in MySQL instances. Don't set this field for PostgreSQL and SQL Server instances. Can be an IP address. Changing this forces a new resource to be created.

Link copied to clipboard
val instance: Output<String>? = null

The name of the Cloud SQL instance. Changing this forces a new resource to be created.

Link copied to clipboard
val name: Output<String>? = null

The name of the user. Changing this forces a new resource to be created.

Link copied to clipboard
val password: Output<String>? = null

The password for the user. Can be updated. For Postgres instances this is a Required field, unless type is set to either CLOUD_IAM_USER or CLOUD_IAM_SERVICE_ACCOUNT. Don't set this field for CLOUD_IAM_USER and CLOUD_IAM_SERVICE_ACCOUNT user types for any Cloud SQL instance.

Link copied to clipboard
Link copied to clipboard
val project: Output<String>? = null

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Link copied to clipboard
val type: Output<String>? = null

The user type. It determines the method to authenticate the user during login. The default is the database's built-in user type. Flags include "BUILT_IN", "CLOUD_IAM_USER", or "CLOUD_IAM_SERVICE_ACCOUNT".