mysql.User
Explore with Pulumi AI
The mysql.User
resource creates and manages a user on a MySQL
server.
Examples
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as mysql from "@pulumi/mysql";
const jdoe = new mysql.User("jdoe", {
user: "jdoe",
host: "example.com",
plaintextPassword: "password",
});
import pulumi
import pulumi_mysql as mysql
jdoe = mysql.User("jdoe",
user="jdoe",
host="example.com",
plaintext_password="password")
package main
import (
"github.com/pulumi/pulumi-mysql/sdk/v3/go/mysql"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := mysql.NewUser(ctx, "jdoe", &mysql.UserArgs{
User: pulumi.String("jdoe"),
Host: pulumi.String("example.com"),
PlaintextPassword: pulumi.String("password"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using MySql = Pulumi.MySql;
return await Deployment.RunAsync(() =>
{
var jdoe = new MySql.User("jdoe", new()
{
UserName = "jdoe",
Host = "example.com",
PlaintextPassword = "password",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.mysql.User;
import com.pulumi.mysql.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 jdoe = new User("jdoe", UserArgs.builder()
.user("jdoe")
.host("example.com")
.plaintextPassword("password")
.build());
}
}
resources:
jdoe:
type: mysql:User
properties:
user: jdoe
host: example.com
plaintextPassword: password
Example Usage with an Authentication Plugin
import * as pulumi from "@pulumi/pulumi";
import * as mysql from "@pulumi/mysql";
const nologin = new mysql.User("nologin", {
user: "nologin",
host: "example.com",
authPlugin: "mysql_no_login",
});
import pulumi
import pulumi_mysql as mysql
nologin = mysql.User("nologin",
user="nologin",
host="example.com",
auth_plugin="mysql_no_login")
package main
import (
"github.com/pulumi/pulumi-mysql/sdk/v3/go/mysql"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := mysql.NewUser(ctx, "nologin", &mysql.UserArgs{
User: pulumi.String("nologin"),
Host: pulumi.String("example.com"),
AuthPlugin: pulumi.String("mysql_no_login"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using MySql = Pulumi.MySql;
return await Deployment.RunAsync(() =>
{
var nologin = new MySql.User("nologin", new()
{
UserName = "nologin",
Host = "example.com",
AuthPlugin = "mysql_no_login",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.mysql.User;
import com.pulumi.mysql.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 nologin = new User("nologin", UserArgs.builder()
.user("nologin")
.host("example.com")
.authPlugin("mysql_no_login")
.build());
}
}
resources:
nologin:
type: mysql:User
properties:
user: nologin
host: example.com
authPlugin: mysql_no_login
Create User Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new User(name: string, args: UserArgs, opts?: CustomResourceOptions);
@overload
def User(resource_name: str,
args: UserArgs,
opts: Optional[ResourceOptions] = None)
@overload
def User(resource_name: str,
opts: Optional[ResourceOptions] = None,
user: Optional[str] = None,
auth_plugin: Optional[str] = None,
host: Optional[str] = None,
password: Optional[str] = None,
plaintext_password: Optional[str] = None,
tls_option: Optional[str] = None)
func NewUser(ctx *Context, name string, args UserArgs, opts ...ResourceOption) (*User, error)
public User(string name, UserArgs args, CustomResourceOptions? opts = null)
type: mysql:User
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args UserArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args UserArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args UserArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args UserArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args UserArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var userResource = new MySql.User("userResource", new()
{
UserName = "string",
AuthPlugin = "string",
Host = "string",
PlaintextPassword = "string",
TlsOption = "string",
});
example, err := mysql.NewUser(ctx, "userResource", &mysql.UserArgs{
User: pulumi.String("string"),
AuthPlugin: pulumi.String("string"),
Host: pulumi.String("string"),
PlaintextPassword: pulumi.String("string"),
TlsOption: pulumi.String("string"),
})
var userResource = new User("userResource", UserArgs.builder()
.user("string")
.authPlugin("string")
.host("string")
.plaintextPassword("string")
.tlsOption("string")
.build());
user_resource = mysql.User("userResource",
user="string",
auth_plugin="string",
host="string",
plaintext_password="string",
tls_option="string")
const userResource = new mysql.User("userResource", {
user: "string",
authPlugin: "string",
host: "string",
plaintextPassword: "string",
tlsOption: "string",
});
type: mysql:User
properties:
authPlugin: string
host: string
plaintextPassword: string
tlsOption: string
user: string
User Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The User resource accepts the following input properties:
- User
Name string - The name of the user.
- Auth
Plugin string - Use an [authentication plugin][ref-auth-plugins] to authenticate the user instead of using password authentication. Description of the fields allowed in the block below. Conflicts with
password
andplaintext_password
. - Host string
- The source host of the user. Defaults to "localhost".
- Password string
- Deprecated alias of
plaintext_password
, whose value is stored as plaintext in state. Prefer to useplaintext_password
instead, which stores the password as an unsalted hash. Conflicts withauth_plugin
. - Plaintext
Password string - The password for the user. This must be provided in plain text, so the data source for it must be secured. An unsalted hash of the provided password is stored in state. Conflicts with
auth_plugin
. - Tls
Option string - An TLS-Option for the
CREATE USER
orALTER USER
statement. The value is suffixed toREQUIRE
. A value of 'SSL' will generate aCREATE USER ... REQUIRE SSL
statement. See the MYSQLCREATE USER
documentation for more. Ignored if MySQL version is under 5.7.0.
- User string
- The name of the user.
- Auth
Plugin string - Use an [authentication plugin][ref-auth-plugins] to authenticate the user instead of using password authentication. Description of the fields allowed in the block below. Conflicts with
password
andplaintext_password
. - Host string
- The source host of the user. Defaults to "localhost".
- Password string
- Deprecated alias of
plaintext_password
, whose value is stored as plaintext in state. Prefer to useplaintext_password
instead, which stores the password as an unsalted hash. Conflicts withauth_plugin
. - Plaintext
Password string - The password for the user. This must be provided in plain text, so the data source for it must be secured. An unsalted hash of the provided password is stored in state. Conflicts with
auth_plugin
. - Tls
Option string - An TLS-Option for the
CREATE USER
orALTER USER
statement. The value is suffixed toREQUIRE
. A value of 'SSL' will generate aCREATE USER ... REQUIRE SSL
statement. See the MYSQLCREATE USER
documentation for more. Ignored if MySQL version is under 5.7.0.
- user String
- The name of the user.
- auth
Plugin String - Use an [authentication plugin][ref-auth-plugins] to authenticate the user instead of using password authentication. Description of the fields allowed in the block below. Conflicts with
password
andplaintext_password
. - host String
- The source host of the user. Defaults to "localhost".
- password String
- Deprecated alias of
plaintext_password
, whose value is stored as plaintext in state. Prefer to useplaintext_password
instead, which stores the password as an unsalted hash. Conflicts withauth_plugin
. - plaintext
Password String - The password for the user. This must be provided in plain text, so the data source for it must be secured. An unsalted hash of the provided password is stored in state. Conflicts with
auth_plugin
. - tls
Option String - An TLS-Option for the
CREATE USER
orALTER USER
statement. The value is suffixed toREQUIRE
. A value of 'SSL' will generate aCREATE USER ... REQUIRE SSL
statement. See the MYSQLCREATE USER
documentation for more. Ignored if MySQL version is under 5.7.0.
- user string
- The name of the user.
- auth
Plugin string - Use an [authentication plugin][ref-auth-plugins] to authenticate the user instead of using password authentication. Description of the fields allowed in the block below. Conflicts with
password
andplaintext_password
. - host string
- The source host of the user. Defaults to "localhost".
- password string
- Deprecated alias of
plaintext_password
, whose value is stored as plaintext in state. Prefer to useplaintext_password
instead, which stores the password as an unsalted hash. Conflicts withauth_plugin
. - plaintext
Password string - The password for the user. This must be provided in plain text, so the data source for it must be secured. An unsalted hash of the provided password is stored in state. Conflicts with
auth_plugin
. - tls
Option string - An TLS-Option for the
CREATE USER
orALTER USER
statement. The value is suffixed toREQUIRE
. A value of 'SSL' will generate aCREATE USER ... REQUIRE SSL
statement. See the MYSQLCREATE USER
documentation for more. Ignored if MySQL version is under 5.7.0.
- user str
- The name of the user.
- auth_
plugin str - Use an [authentication plugin][ref-auth-plugins] to authenticate the user instead of using password authentication. Description of the fields allowed in the block below. Conflicts with
password
andplaintext_password
. - host str
- The source host of the user. Defaults to "localhost".
- password str
- Deprecated alias of
plaintext_password
, whose value is stored as plaintext in state. Prefer to useplaintext_password
instead, which stores the password as an unsalted hash. Conflicts withauth_plugin
. - plaintext_
password str - The password for the user. This must be provided in plain text, so the data source for it must be secured. An unsalted hash of the provided password is stored in state. Conflicts with
auth_plugin
. - tls_
option str - An TLS-Option for the
CREATE USER
orALTER USER
statement. The value is suffixed toREQUIRE
. A value of 'SSL' will generate aCREATE USER ... REQUIRE SSL
statement. See the MYSQLCREATE USER
documentation for more. Ignored if MySQL version is under 5.7.0.
- user String
- The name of the user.
- auth
Plugin String - Use an [authentication plugin][ref-auth-plugins] to authenticate the user instead of using password authentication. Description of the fields allowed in the block below. Conflicts with
password
andplaintext_password
. - host String
- The source host of the user. Defaults to "localhost".
- password String
- Deprecated alias of
plaintext_password
, whose value is stored as plaintext in state. Prefer to useplaintext_password
instead, which stores the password as an unsalted hash. Conflicts withauth_plugin
. - plaintext
Password String - The password for the user. This must be provided in plain text, so the data source for it must be secured. An unsalted hash of the provided password is stored in state. Conflicts with
auth_plugin
. - tls
Option String - An TLS-Option for the
CREATE USER
orALTER USER
statement. The value is suffixed toREQUIRE
. A value of 'SSL' will generate aCREATE USER ... REQUIRE SSL
statement. See the MYSQLCREATE USER
documentation for more. Ignored if MySQL version is under 5.7.0.
Outputs
All input properties are implicitly available as output properties. Additionally, the User resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing User Resource
Get an existing User resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: UserState, opts?: CustomResourceOptions): User
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
auth_plugin: Optional[str] = None,
host: Optional[str] = None,
password: Optional[str] = None,
plaintext_password: Optional[str] = None,
tls_option: Optional[str] = None,
user: Optional[str] = None) -> User
func GetUser(ctx *Context, name string, id IDInput, state *UserState, opts ...ResourceOption) (*User, error)
public static User Get(string name, Input<string> id, UserState? state, CustomResourceOptions? opts = null)
public static User get(String name, Output<String> id, UserState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Auth
Plugin string - Use an [authentication plugin][ref-auth-plugins] to authenticate the user instead of using password authentication. Description of the fields allowed in the block below. Conflicts with
password
andplaintext_password
. - Host string
- The source host of the user. Defaults to "localhost".
- Password string
- Deprecated alias of
plaintext_password
, whose value is stored as plaintext in state. Prefer to useplaintext_password
instead, which stores the password as an unsalted hash. Conflicts withauth_plugin
. - Plaintext
Password string - The password for the user. This must be provided in plain text, so the data source for it must be secured. An unsalted hash of the provided password is stored in state. Conflicts with
auth_plugin
. - Tls
Option string - An TLS-Option for the
CREATE USER
orALTER USER
statement. The value is suffixed toREQUIRE
. A value of 'SSL' will generate aCREATE USER ... REQUIRE SSL
statement. See the MYSQLCREATE USER
documentation for more. Ignored if MySQL version is under 5.7.0. - User
Name string - The name of the user.
- Auth
Plugin string - Use an [authentication plugin][ref-auth-plugins] to authenticate the user instead of using password authentication. Description of the fields allowed in the block below. Conflicts with
password
andplaintext_password
. - Host string
- The source host of the user. Defaults to "localhost".
- Password string
- Deprecated alias of
plaintext_password
, whose value is stored as plaintext in state. Prefer to useplaintext_password
instead, which stores the password as an unsalted hash. Conflicts withauth_plugin
. - Plaintext
Password string - The password for the user. This must be provided in plain text, so the data source for it must be secured. An unsalted hash of the provided password is stored in state. Conflicts with
auth_plugin
. - Tls
Option string - An TLS-Option for the
CREATE USER
orALTER USER
statement. The value is suffixed toREQUIRE
. A value of 'SSL' will generate aCREATE USER ... REQUIRE SSL
statement. See the MYSQLCREATE USER
documentation for more. Ignored if MySQL version is under 5.7.0. - User string
- The name of the user.
- auth
Plugin String - Use an [authentication plugin][ref-auth-plugins] to authenticate the user instead of using password authentication. Description of the fields allowed in the block below. Conflicts with
password
andplaintext_password
. - host String
- The source host of the user. Defaults to "localhost".
- password String
- Deprecated alias of
plaintext_password
, whose value is stored as plaintext in state. Prefer to useplaintext_password
instead, which stores the password as an unsalted hash. Conflicts withauth_plugin
. - plaintext
Password String - The password for the user. This must be provided in plain text, so the data source for it must be secured. An unsalted hash of the provided password is stored in state. Conflicts with
auth_plugin
. - tls
Option String - An TLS-Option for the
CREATE USER
orALTER USER
statement. The value is suffixed toREQUIRE
. A value of 'SSL' will generate aCREATE USER ... REQUIRE SSL
statement. See the MYSQLCREATE USER
documentation for more. Ignored if MySQL version is under 5.7.0. - user String
- The name of the user.
- auth
Plugin string - Use an [authentication plugin][ref-auth-plugins] to authenticate the user instead of using password authentication. Description of the fields allowed in the block below. Conflicts with
password
andplaintext_password
. - host string
- The source host of the user. Defaults to "localhost".
- password string
- Deprecated alias of
plaintext_password
, whose value is stored as plaintext in state. Prefer to useplaintext_password
instead, which stores the password as an unsalted hash. Conflicts withauth_plugin
. - plaintext
Password string - The password for the user. This must be provided in plain text, so the data source for it must be secured. An unsalted hash of the provided password is stored in state. Conflicts with
auth_plugin
. - tls
Option string - An TLS-Option for the
CREATE USER
orALTER USER
statement. The value is suffixed toREQUIRE
. A value of 'SSL' will generate aCREATE USER ... REQUIRE SSL
statement. See the MYSQLCREATE USER
documentation for more. Ignored if MySQL version is under 5.7.0. - user string
- The name of the user.
- auth_
plugin str - Use an [authentication plugin][ref-auth-plugins] to authenticate the user instead of using password authentication. Description of the fields allowed in the block below. Conflicts with
password
andplaintext_password
. - host str
- The source host of the user. Defaults to "localhost".
- password str
- Deprecated alias of
plaintext_password
, whose value is stored as plaintext in state. Prefer to useplaintext_password
instead, which stores the password as an unsalted hash. Conflicts withauth_plugin
. - plaintext_
password str - The password for the user. This must be provided in plain text, so the data source for it must be secured. An unsalted hash of the provided password is stored in state. Conflicts with
auth_plugin
. - tls_
option str - An TLS-Option for the
CREATE USER
orALTER USER
statement. The value is suffixed toREQUIRE
. A value of 'SSL' will generate aCREATE USER ... REQUIRE SSL
statement. See the MYSQLCREATE USER
documentation for more. Ignored if MySQL version is under 5.7.0. - user str
- The name of the user.
- auth
Plugin String - Use an [authentication plugin][ref-auth-plugins] to authenticate the user instead of using password authentication. Description of the fields allowed in the block below. Conflicts with
password
andplaintext_password
. - host String
- The source host of the user. Defaults to "localhost".
- password String
- Deprecated alias of
plaintext_password
, whose value is stored as plaintext in state. Prefer to useplaintext_password
instead, which stores the password as an unsalted hash. Conflicts withauth_plugin
. - plaintext
Password String - The password for the user. This must be provided in plain text, so the data source for it must be secured. An unsalted hash of the provided password is stored in state. Conflicts with
auth_plugin
. - tls
Option String - An TLS-Option for the
CREATE USER
orALTER USER
statement. The value is suffixed toREQUIRE
. A value of 'SSL' will generate aCREATE USER ... REQUIRE SSL
statement. See the MYSQLCREATE USER
documentation for more. Ignored if MySQL version is under 5.7.0. - user String
- The name of the user.
Package Details
- Repository
- MySQL pulumi/pulumi-mysql
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
mysql
Terraform Provider.