This page documents the language specification for the mysql package. If you're looking for help working with the inputs, outputs, or functions of mysql resources in a Pulumi program, please see the resource documentation for examples and API reference.
Pulumi MySQL¶
This provider is a derived work of the Terraform Provider distributed under MPL 2.0. If you encounter a bug or missing feature, first check the pulumi/pulumi-mysql repo; however, if that doesn’t turn up anything, please consult the source terraform-providers/terraform-provider-mysql repo.
- class
pulumi_mysql.Database(resource_name, opts=None, default_character_set=None, default_collation=None, name=None, __props__=None, __name__=None, __opts__=None)¶ The
.Databaseresource creates and manages a database on a MySQL server.Caution: The
.Databaseresource can completely delete your database just as easily as it can create it. To avoid costly accidents, consider setting ``prevent_destroy` <https://www.terraform.io/docs/configuration/resources.html#prevent_destroy>`_ on your database resources as an extra safety measure.import pulumi import pulumi_mysql as mysql app = mysql.Database("app")
- Parameters
resource_name (str) – The name of the resource.
opts (pulumi.ResourceOptions) – Options for the resource.
default_character_set (pulumi.Input[str]) – The default character set to use when a table is created without specifying an explicit character set. Defaults to “utf8”.
default_collation (pulumi.Input[str]) – The default collation to use when a table is created without specifying an explicit collation. Defaults to
utf8_general_ci. Each character set has its own set of collations, so changing the character set requires also changing the collation.name (pulumi.Input[str]) – The name of the database. This must be unique within a given MySQL server and may or may not be case-sensitive depending on the operating system on which the MySQL server is running.
default_character_set: pulumi.Output[str] = None¶The default character set to use when a table is created without specifying an explicit character set. Defaults to “utf8”.
default_collation: pulumi.Output[str] = None¶The default collation to use when a table is created without specifying an explicit collation. Defaults to
utf8_general_ci. Each character set has its own set of collations, so changing the character set requires also changing the collation.
name: pulumi.Output[str] = None¶The name of the database. This must be unique within a given MySQL server and may or may not be case-sensitive depending on the operating system on which the MySQL server is running.
- static
get(resource_name, id, opts=None, default_character_set=None, default_collation=None, name=None)¶ Get an existing Database resource’s state with the given name, id, and optional extra properties used to qualify the lookup.
- Parameters
resource_name (str) – The unique name of the resulting resource.
id (str) – The unique provider ID of the resource to lookup.
opts (pulumi.ResourceOptions) – Options for the resource.
default_character_set (pulumi.Input[str]) – The default character set to use when a table is created without specifying an explicit character set. Defaults to “utf8”.
default_collation (pulumi.Input[str]) – The default collation to use when a table is created without specifying an explicit collation. Defaults to
utf8_general_ci. Each character set has its own set of collations, so changing the character set requires also changing the collation.name (pulumi.Input[str]) – The name of the database. This must be unique within a given MySQL server and may or may not be case-sensitive depending on the operating system on which the MySQL server is running.
translate_output_property(prop)¶Provides subclasses of Resource an opportunity to translate names of output properties into a format of their choosing before writing those properties to the resource object.
- Parameters
prop (str) – A property name.
- Returns
A potentially transformed property name.
- Return type
str
translate_input_property(prop)¶Provides subclasses of Resource an opportunity to translate names of input properties into a format of their choosing before sending those properties to the Pulumi engine.
- Parameters
prop (str) – A property name.
- Returns
A potentially transformed property name.
- Return type
str
- class
pulumi_mysql.Grant(resource_name, opts=None, database=None, grant=None, host=None, privileges=None, role=None, roles=None, table=None, tls_option=None, user=None, __props__=None, __name__=None, __opts__=None)¶ The
.Grantresource creates and manages privileges given to a user on a MySQL server.import pulumi import pulumi_mysql as mysql jdoe_user = mysql.User("jdoeUser", host="example.com", plaintext_password="password", user="jdoe") jdoe_grant = mysql.Grant("jdoeGrant", database="app", host=jdoe_user.host, privileges=[ "SELECT", "UPDATE", ], user=jdoe_user.user)
import pulumi import pulumi_mysql as mysql developer_role = mysql.Role("developerRole") developer_grant = mysql.Grant("developerGrant", database="app", privileges=[ "SELECT", "UPDATE", ], role=developer_role.name)
import pulumi import pulumi_mysql as mysql jdoe = mysql.User("jdoe", host="example.com", plaintext_password="password", user="jdoe") developer_role = mysql.Role("developerRole") developer_grant = mysql.Grant("developerGrant", database="app", host=jdoe.host, roles=[developer_role.name], user=jdoe.user)
- Parameters
resource_name (str) – The name of the resource.
opts (pulumi.ResourceOptions) – Options for the resource.
database (pulumi.Input[str]) – The database to grant privileges on.
grant (pulumi.Input[bool]) – Whether to also give the user privileges to grant the same privileges to other users.
host (pulumi.Input[str]) – The source host of the user. Defaults to “localhost”. Conflicts with
role.privileges (pulumi.Input[list]) – A list of privileges to grant to the user. Refer to a list of privileges (such as here) for applicable privileges. Conflicts with
roles.role (pulumi.Input[str]) – The role to grant
privilegesto. Conflicts withuserandhost.roles (pulumi.Input[list]) – A list of rols to grant to the user. Conflicts with
privileges.table (pulumi.Input[str]) – Which table to grant
privilegeson. Defaults to*, which is all tables.tls_option (pulumi.Input[str]) – An TLS-Option for the
GRANTstatement. The value is suffixed toREQUIRE. A value of ‘SSL’ will generate aGRANT ... REQUIRE SSLstatement. See the MYSQL ``GRANT` documentation <https://dev.mysql.com/doc/refman/5.7/en/grant.html>`_ for more. Ignored if MySQL version is under 5.7.0.user (pulumi.Input[str]) – The name of the user. Conflicts with
role.
database: pulumi.Output[str] = None¶The database to grant privileges on.
grant: pulumi.Output[bool] = None¶Whether to also give the user privileges to grant the same privileges to other users.
host: pulumi.Output[str] = None¶The source host of the user. Defaults to “localhost”. Conflicts with
role.
privileges: pulumi.Output[list] = None¶A list of privileges to grant to the user. Refer to a list of privileges (such as here) for applicable privileges. Conflicts with
roles.
role: pulumi.Output[str] = None¶The role to grant
privilegesto. Conflicts withuserandhost.
roles: pulumi.Output[list] = None¶A list of rols to grant to the user. Conflicts with
privileges.
table: pulumi.Output[str] = None¶Which table to grant
privilegeson. Defaults to*, which is all tables.
tls_option: pulumi.Output[str] = None¶An TLS-Option for the
GRANTstatement. The value is suffixed toREQUIRE. A value of ‘SSL’ will generate aGRANT ... REQUIRE SSLstatement. See the MYSQL ``GRANT` documentation <https://dev.mysql.com/doc/refman/5.7/en/grant.html>`_ for more. Ignored if MySQL version is under 5.7.0.
user: pulumi.Output[str] = None¶The name of the user. Conflicts with
role.
- static
get(resource_name, id, opts=None, database=None, grant=None, host=None, privileges=None, role=None, roles=None, table=None, tls_option=None, user=None)¶ Get an existing Grant resource’s state with the given name, id, and optional extra properties used to qualify the lookup.
- Parameters
resource_name (str) – The unique name of the resulting resource.
id (str) – The unique provider ID of the resource to lookup.
opts (pulumi.ResourceOptions) – Options for the resource.
database (pulumi.Input[str]) – The database to grant privileges on.
grant (pulumi.Input[bool]) – Whether to also give the user privileges to grant the same privileges to other users.
host (pulumi.Input[str]) – The source host of the user. Defaults to “localhost”. Conflicts with
role.privileges (pulumi.Input[list]) –
A list of privileges to grant to the user. Refer to a list of privileges (such as here) for applicable privileges. Conflicts with
roles.role (pulumi.Input[str]) – The role to grant
privilegesto. Conflicts withuserandhost.roles (pulumi.Input[list]) – A list of rols to grant to the user. Conflicts with
privileges.table (pulumi.Input[str]) – Which table to grant
privilegeson. Defaults to*, which is all tables.tls_option (pulumi.Input[str]) – An TLS-Option for the
GRANTstatement. The value is suffixed toREQUIRE. A value of ‘SSL’ will generate aGRANT ... REQUIRE SSLstatement. See the MYSQL ``GRANT` documentation <https://dev.mysql.com/doc/refman/5.7/en/grant.html>`_ for more. Ignored if MySQL version is under 5.7.0.user (pulumi.Input[str]) – The name of the user. Conflicts with
role.
translate_output_property(prop)¶Provides subclasses of Resource an opportunity to translate names of output properties into a format of their choosing before writing those properties to the resource object.
- Parameters
prop (str) – A property name.
- Returns
A potentially transformed property name.
- Return type
str
translate_input_property(prop)¶Provides subclasses of Resource an opportunity to translate names of input properties into a format of their choosing before sending those properties to the Pulumi engine.
- Parameters
prop (str) – A property name.
- Returns
A potentially transformed property name.
- Return type
str
- class
pulumi_mysql.Provider(resource_name, opts=None, authentication_plugin=None, endpoint=None, max_conn_lifetime_sec=None, max_open_conns=None, password=None, proxy=None, tls=None, username=None, __props__=None, __name__=None, __opts__=None)¶ The provider type for the mysql package. By default, resources use package-wide configuration settings, however an explicit
Providerinstance may be created and passed during resource construction to achieve fine-grained programmatic control over provider settings. See the documentation for more information.- Parameters
resource_name (str) – The name of the resource.
opts (pulumi.ResourceOptions) – Options for the resource.
translate_output_property(prop)¶Provides subclasses of Resource an opportunity to translate names of output properties into a format of their choosing before writing those properties to the resource object.
- Parameters
prop (str) – A property name.
- Returns
A potentially transformed property name.
- Return type
str
translate_input_property(prop)¶Provides subclasses of Resource an opportunity to translate names of input properties into a format of their choosing before sending those properties to the Pulumi engine.
- Parameters
prop (str) – A property name.
- Returns
A potentially transformed property name.
- Return type
str
- class
pulumi_mysql.Role(resource_name, opts=None, name=None, __props__=None, __name__=None, __opts__=None)¶ The
.Roleresource creates and manages a user on a MySQL server.Note: MySQL introduced roles in version 8. They do not work on MySQL 5 and lower.
import pulumi import pulumi_mysql as mysql developer = mysql.Role("developer")
- Parameters
resource_name (str) – The name of the resource.
opts (pulumi.ResourceOptions) – Options for the resource.
name (pulumi.Input[str]) – The name of the role.
name: pulumi.Output[str] = None¶The name of the role.
- static
get(resource_name, id, opts=None, name=None)¶ Get an existing Role resource’s state with the given name, id, and optional extra properties used to qualify the lookup.
- Parameters
resource_name (str) – The unique name of the resulting resource.
id (str) – The unique provider ID of the resource to lookup.
opts (pulumi.ResourceOptions) – Options for the resource.
name (pulumi.Input[str]) – The name of the role.
translate_output_property(prop)¶Provides subclasses of Resource an opportunity to translate names of output properties into a format of their choosing before writing those properties to the resource object.
- Parameters
prop (str) – A property name.
- Returns
A potentially transformed property name.
- Return type
str
translate_input_property(prop)¶Provides subclasses of Resource an opportunity to translate names of input properties into a format of their choosing before sending those properties to the Pulumi engine.
- Parameters
prop (str) – A property name.
- Returns
A potentially transformed property name.
- Return type
str
- class
pulumi_mysql.User(resource_name, opts=None, auth_plugin=None, host=None, password=None, plaintext_password=None, tls_option=None, user=None, __props__=None, __name__=None, __opts__=None)¶ The
.Userresource creates and manages a user on a MySQL server.Note: The password for the user is provided in plain text, and is obscured by an unsalted hash in the state Read more about sensitive data in state. Care is required when using this resource, to avoid disclosing the password.
import pulumi import pulumi_mysql as mysql jdoe = mysql.User("jdoe", host="example.com", plaintext_password="password", user="jdoe")
import pulumi import pulumi_mysql as mysql nologin = mysql.User("nologin", auth_plugin="mysql_no_login", host="example.com", user="nologin")
- Parameters
resource_name (str) – The name of the resource.
opts (pulumi.ResourceOptions) – Options for the resource.
auth_plugin (pulumi.Input[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
passwordandplaintext_password.host (pulumi.Input[str]) – The source host of the user. Defaults to “localhost”.
password (pulumi.Input[str]) – Deprecated alias of
plaintext_password, whose value is stored as plaintext in state. Prefer to useplaintext_passwordinstead, which stores the password as an unsalted hash. Conflicts withauth_plugin.plaintext_password (pulumi.Input[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 (pulumi.Input[str]) – An TLS-Option for the
CREATE USERorALTER USERstatement. The value is suffixed toREQUIRE. A value of ‘SSL’ will generate aCREATE USER ... REQUIRE SSLstatement. See the MYSQL ``CREATE USER` documentation <https://dev.mysql.com/doc/refman/5.7/en/create-user.html>`_ for more. Ignored if MySQL version is under 5.7.0.user (pulumi.Input[str]) – The name of the user.
auth_plugin: pulumi.Output[str] = None¶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
passwordandplaintext_password.
host: pulumi.Output[str] = None¶The source host of the user. Defaults to “localhost”.
password: pulumi.Output[str] = None¶Deprecated alias of
plaintext_password, whose value is stored as plaintext in state. Prefer to useplaintext_passwordinstead, which stores the password as an unsalted hash. Conflicts withauth_plugin.
plaintext_password: pulumi.Output[str] = None¶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: pulumi.Output[str] = None¶An TLS-Option for the
CREATE USERorALTER USERstatement. The value is suffixed toREQUIRE. A value of ‘SSL’ will generate aCREATE USER ... REQUIRE SSLstatement. See the MYSQL ``CREATE USER` documentation <https://dev.mysql.com/doc/refman/5.7/en/create-user.html>`_ for more. Ignored if MySQL version is under 5.7.0.
user: pulumi.Output[str] = None¶The name of the user.
- static
get(resource_name, id, opts=None, auth_plugin=None, host=None, password=None, plaintext_password=None, tls_option=None, user=None)¶ Get an existing User resource’s state with the given name, id, and optional extra properties used to qualify the lookup.
- Parameters
resource_name (str) – The unique name of the resulting resource.
id (str) – The unique provider ID of the resource to lookup.
opts (pulumi.ResourceOptions) – Options for the resource.
auth_plugin (pulumi.Input[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
passwordandplaintext_password.host (pulumi.Input[str]) – The source host of the user. Defaults to “localhost”.
password (pulumi.Input[str]) – Deprecated alias of
plaintext_password, whose value is stored as plaintext in state. Prefer to useplaintext_passwordinstead, which stores the password as an unsalted hash. Conflicts withauth_plugin.plaintext_password (pulumi.Input[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 (pulumi.Input[str]) – An TLS-Option for the
CREATE USERorALTER USERstatement. The value is suffixed toREQUIRE. A value of ‘SSL’ will generate aCREATE USER ... REQUIRE SSLstatement. See the MYSQL ``CREATE USER` documentation <https://dev.mysql.com/doc/refman/5.7/en/create-user.html>`_ for more. Ignored if MySQL version is under 5.7.0.user (pulumi.Input[str]) – The name of the user.
translate_output_property(prop)¶Provides subclasses of Resource an opportunity to translate names of output properties into a format of their choosing before writing those properties to the resource object.
- Parameters
prop (str) – A property name.
- Returns
A potentially transformed property name.
- Return type
str
translate_input_property(prop)¶Provides subclasses of Resource an opportunity to translate names of input properties into a format of their choosing before sending those properties to the Pulumi engine.
- Parameters
prop (str) – A property name.
- Returns
A potentially transformed property name.
- Return type
str
- class
pulumi_mysql.UserPassword(resource_name, opts=None, host=None, pgp_key=None, user=None, __props__=None, __name__=None, __opts__=None)¶ Create a UserPassword resource with the given unique name, props, and options. :param str resource_name: The name of the resource. :param pulumi.ResourceOptions opts: Options for the resource. :param pulumi.Input[str] host: The source host of the user. Defaults to
localhost. :param pulumi.Input[str] pgp_key: Either a base-64 encoded PGP public key, or a keybase username in the formkeybase:some_person_that_exists. :param pulumi.Input[str] user: The IAM user to associate with this access key.encrypted_password: pulumi.Output[str] = None¶The encrypted password, base64 encoded.
host: pulumi.Output[str] = None¶The source host of the user. Defaults to
localhost.
key_fingerprint: pulumi.Output[str] = None¶The fingerprint of the PGP key used to encrypt the password
pgp_key: pulumi.Output[str] = None¶Either a base-64 encoded PGP public key, or a keybase username in the form
keybase:some_person_that_exists.
user: pulumi.Output[str] = None¶The IAM user to associate with this access key.
- static
get(resource_name, id, opts=None, encrypted_password=None, host=None, key_fingerprint=None, pgp_key=None, user=None)¶ Get an existing UserPassword resource’s state with the given name, id, and optional extra properties used to qualify the lookup.
- Parameters
resource_name (str) – The unique name of the resulting resource.
id (str) – The unique provider ID of the resource to lookup.
opts (pulumi.ResourceOptions) – Options for the resource.
encrypted_password (pulumi.Input[str]) – The encrypted password, base64 encoded.
host (pulumi.Input[str]) – The source host of the user. Defaults to
localhost.key_fingerprint (pulumi.Input[str]) – The fingerprint of the PGP key used to encrypt the password
pgp_key (pulumi.Input[str]) – Either a base-64 encoded PGP public key, or a keybase username in the form
keybase:some_person_that_exists.user (pulumi.Input[str]) – The IAM user to associate with this access key.
translate_output_property(prop)¶Provides subclasses of Resource an opportunity to translate names of output properties into a format of their choosing before writing those properties to the resource object.
- Parameters
prop (str) – A property name.
- Returns
A potentially transformed property name.
- Return type
str
translate_input_property(prop)¶Provides subclasses of Resource an opportunity to translate names of input properties into a format of their choosing before sending those properties to the Pulumi engine.
- Parameters
prop (str) – A property name.
- Returns
A potentially transformed property name.
- Return type
str