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", {
host: "example.com",
plaintextPassword: "password",
user: "jdoe",
});
import pulumi
import pulumi_mysql as mysql
jdoe = mysql.User("jdoe",
host="example.com",
plaintext_password="password",
user="jdoe")
using Pulumi;
using MySql = Pulumi.MySql;
class MyStack : Stack
{
public MyStack()
{
var jdoe = new MySql.User("jdoe", new MySql.UserArgs
{
Host = "example.com",
PlaintextPassword = "password",
User = "jdoe",
});
}
}
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{
Host: pulumi.String("example.com"),
PlaintextPassword: pulumi.String("password"),
User: pulumi.String("jdoe"),
})
if err != nil {
return err
}
return nil
})
}
Example Usage with an Authentication Plugin
import * as pulumi from "@pulumi/pulumi";
import * as mysql from "@pulumi/mysql";
const nologin = new mysql.User("nologin", {
authPlugin: "mysql_no_login",
host: "example.com",
user: "nologin",
});
import pulumi
import pulumi_mysql as mysql
nologin = mysql.User("nologin",
auth_plugin="mysql_no_login",
host="example.com",
user="nologin")
using Pulumi;
using MySql = Pulumi.MySql;
class MyStack : Stack
{
public MyStack()
{
var nologin = new MySql.User("nologin", new MySql.UserArgs
{
AuthPlugin = "mysql_no_login",
Host = "example.com",
User = "nologin",
});
}
}
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{
AuthPlugin: pulumi.String("mysql_no_login"),
Host: pulumi.String("example.com"),
User: pulumi.String("nologin"),
})
if err != nil {
return err
}
return nil
})
}
Create User Resource
new User(name: string, args: UserArgs, opts?: CustomResourceOptions);
@overload
def User(resource_name: 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)
@overload
def User(resource_name: str,
args: UserArgs,
opts: Optional[ResourceOptions] = 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.
- 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.
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
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
.Please use plaintext_password instead
- 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
.Please use plaintext_password instead
- 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
.Please use plaintext_password instead
- 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
.Please use plaintext_password instead
- 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
.Please use plaintext_password instead
- 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
.Please use plaintext_password instead
- 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
.Please use plaintext_password instead
- 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
.Please use plaintext_password instead
- 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
.Please use plaintext_password instead
- 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
.Please use plaintext_password instead
- 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
.Please use plaintext_password instead
- 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
.Please use plaintext_password instead
- 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.