1. Packages
  2. Aiven Provider
  3. API Docs
  4. MysqlUser
Aiven v6.37.0 published on Thursday, Apr 10, 2025 by Pulumi

aiven.MysqlUser

Explore with Pulumi AI

Creates and manages an Aiven for MySQL® service user.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aiven from "@pulumi/aiven";

const exampleMysqlUser = new aiven.MysqlUser("example_mysql_user", {
    serviceName: exampleMysql.serviceName,
    project: exampleProject.project,
    username: "example-mysql-user",
    password: serviceUserPw,
});
Copy
import pulumi
import pulumi_aiven as aiven

example_mysql_user = aiven.MysqlUser("example_mysql_user",
    service_name=example_mysql["serviceName"],
    project=example_project["project"],
    username="example-mysql-user",
    password=service_user_pw)
Copy
package main

import (
	"github.com/pulumi/pulumi-aiven/sdk/v6/go/aiven"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := aiven.NewMysqlUser(ctx, "example_mysql_user", &aiven.MysqlUserArgs{
			ServiceName: pulumi.Any(exampleMysql.ServiceName),
			Project:     pulumi.Any(exampleProject.Project),
			Username:    pulumi.String("example-mysql-user"),
			Password:    pulumi.Any(serviceUserPw),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aiven = Pulumi.Aiven;

return await Deployment.RunAsync(() => 
{
    var exampleMysqlUser = new Aiven.MysqlUser("example_mysql_user", new()
    {
        ServiceName = exampleMysql.ServiceName,
        Project = exampleProject.Project,
        Username = "example-mysql-user",
        Password = serviceUserPw,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aiven.MysqlUser;
import com.pulumi.aiven.MysqlUserArgs;
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 exampleMysqlUser = new MysqlUser("exampleMysqlUser", MysqlUserArgs.builder()
            .serviceName(exampleMysql.serviceName())
            .project(exampleProject.project())
            .username("example-mysql-user")
            .password(serviceUserPw)
            .build());

    }
}
Copy
resources:
  exampleMysqlUser:
    type: aiven:MysqlUser
    name: example_mysql_user
    properties:
      serviceName: ${exampleMysql.serviceName}
      project: ${exampleProject.project}
      username: example-mysql-user
      password: ${serviceUserPw}
Copy

Create MysqlUser Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new MysqlUser(name: string, args: MysqlUserArgs, opts?: CustomResourceOptions);
@overload
def MysqlUser(resource_name: str,
              args: MysqlUserArgs,
              opts: Optional[ResourceOptions] = None)

@overload
def MysqlUser(resource_name: str,
              opts: Optional[ResourceOptions] = None,
              project: Optional[str] = None,
              service_name: Optional[str] = None,
              username: Optional[str] = None,
              authentication: Optional[str] = None,
              password: Optional[str] = None)
func NewMysqlUser(ctx *Context, name string, args MysqlUserArgs, opts ...ResourceOption) (*MysqlUser, error)
public MysqlUser(string name, MysqlUserArgs args, CustomResourceOptions? opts = null)
public MysqlUser(String name, MysqlUserArgs args)
public MysqlUser(String name, MysqlUserArgs args, CustomResourceOptions options)
type: aiven:MysqlUser
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. MysqlUserArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. MysqlUserArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. MysqlUserArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. MysqlUserArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. MysqlUserArgs
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 mysqlUserResource = new Aiven.MysqlUser("mysqlUserResource", new()
{
    Project = "string",
    ServiceName = "string",
    Username = "string",
    Authentication = "string",
    Password = "string",
});
Copy
example, err := aiven.NewMysqlUser(ctx, "mysqlUserResource", &aiven.MysqlUserArgs{
	Project:        pulumi.String("string"),
	ServiceName:    pulumi.String("string"),
	Username:       pulumi.String("string"),
	Authentication: pulumi.String("string"),
	Password:       pulumi.String("string"),
})
Copy
var mysqlUserResource = new MysqlUser("mysqlUserResource", MysqlUserArgs.builder()
    .project("string")
    .serviceName("string")
    .username("string")
    .authentication("string")
    .password("string")
    .build());
Copy
mysql_user_resource = aiven.MysqlUser("mysqlUserResource",
    project="string",
    service_name="string",
    username="string",
    authentication="string",
    password="string")
Copy
const mysqlUserResource = new aiven.MysqlUser("mysqlUserResource", {
    project: "string",
    serviceName: "string",
    username: "string",
    authentication: "string",
    password: "string",
});
Copy
type: aiven:MysqlUser
properties:
    authentication: string
    password: string
    project: string
    serviceName: string
    username: string
Copy

MysqlUser 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 MysqlUser resource accepts the following input properties:

Project
This property is required.
Changes to this property will trigger replacement.
string
The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
ServiceName
This property is required.
Changes to this property will trigger replacement.
string
The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
Username
This property is required.
Changes to this property will trigger replacement.
string
The name of the MySQL service user. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
Authentication string
Authentication details. The possible values are caching_sha2_password, mysql_native_password and null.
Password string
The password of the MySQL service user.
Project
This property is required.
Changes to this property will trigger replacement.
string
The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
ServiceName
This property is required.
Changes to this property will trigger replacement.
string
The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
Username
This property is required.
Changes to this property will trigger replacement.
string
The name of the MySQL service user. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
Authentication string
Authentication details. The possible values are caching_sha2_password, mysql_native_password and null.
Password string
The password of the MySQL service user.
project
This property is required.
Changes to this property will trigger replacement.
String
The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
serviceName
This property is required.
Changes to this property will trigger replacement.
String
The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
username
This property is required.
Changes to this property will trigger replacement.
String
The name of the MySQL service user. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
authentication String
Authentication details. The possible values are caching_sha2_password, mysql_native_password and null.
password String
The password of the MySQL service user.
project
This property is required.
Changes to this property will trigger replacement.
string
The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
serviceName
This property is required.
Changes to this property will trigger replacement.
string
The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
username
This property is required.
Changes to this property will trigger replacement.
string
The name of the MySQL service user. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
authentication string
Authentication details. The possible values are caching_sha2_password, mysql_native_password and null.
password string
The password of the MySQL service user.
project
This property is required.
Changes to this property will trigger replacement.
str
The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
service_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
username
This property is required.
Changes to this property will trigger replacement.
str
The name of the MySQL service user. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
authentication str
Authentication details. The possible values are caching_sha2_password, mysql_native_password and null.
password str
The password of the MySQL service user.
project
This property is required.
Changes to this property will trigger replacement.
String
The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
serviceName
This property is required.
Changes to this property will trigger replacement.
String
The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
username
This property is required.
Changes to this property will trigger replacement.
String
The name of the MySQL service user. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
authentication String
Authentication details. The possible values are caching_sha2_password, mysql_native_password and null.
password String
The password of the MySQL service user.

Outputs

All input properties are implicitly available as output properties. Additionally, the MysqlUser resource produces the following output properties:

AccessCert string
Access certificate for the user.
AccessKey string
Access certificate key for the user.
Id string
The provider-assigned unique ID for this managed resource.
Type string
User account type, such as primary or regular account.
AccessCert string
Access certificate for the user.
AccessKey string
Access certificate key for the user.
Id string
The provider-assigned unique ID for this managed resource.
Type string
User account type, such as primary or regular account.
accessCert String
Access certificate for the user.
accessKey String
Access certificate key for the user.
id String
The provider-assigned unique ID for this managed resource.
type String
User account type, such as primary or regular account.
accessCert string
Access certificate for the user.
accessKey string
Access certificate key for the user.
id string
The provider-assigned unique ID for this managed resource.
type string
User account type, such as primary or regular account.
access_cert str
Access certificate for the user.
access_key str
Access certificate key for the user.
id str
The provider-assigned unique ID for this managed resource.
type str
User account type, such as primary or regular account.
accessCert String
Access certificate for the user.
accessKey String
Access certificate key for the user.
id String
The provider-assigned unique ID for this managed resource.
type String
User account type, such as primary or regular account.

Look up Existing MysqlUser Resource

Get an existing MysqlUser 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?: MysqlUserState, opts?: CustomResourceOptions): MysqlUser
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        access_cert: Optional[str] = None,
        access_key: Optional[str] = None,
        authentication: Optional[str] = None,
        password: Optional[str] = None,
        project: Optional[str] = None,
        service_name: Optional[str] = None,
        type: Optional[str] = None,
        username: Optional[str] = None) -> MysqlUser
func GetMysqlUser(ctx *Context, name string, id IDInput, state *MysqlUserState, opts ...ResourceOption) (*MysqlUser, error)
public static MysqlUser Get(string name, Input<string> id, MysqlUserState? state, CustomResourceOptions? opts = null)
public static MysqlUser get(String name, Output<String> id, MysqlUserState state, CustomResourceOptions options)
resources:  _:    type: aiven:MysqlUser    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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.
The following state arguments are supported:
AccessCert string
Access certificate for the user.
AccessKey string
Access certificate key for the user.
Authentication string
Authentication details. The possible values are caching_sha2_password, mysql_native_password and null.
Password string
The password of the MySQL service user.
Project Changes to this property will trigger replacement. string
The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
ServiceName Changes to this property will trigger replacement. string
The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
Type string
User account type, such as primary or regular account.
Username Changes to this property will trigger replacement. string
The name of the MySQL service user. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
AccessCert string
Access certificate for the user.
AccessKey string
Access certificate key for the user.
Authentication string
Authentication details. The possible values are caching_sha2_password, mysql_native_password and null.
Password string
The password of the MySQL service user.
Project Changes to this property will trigger replacement. string
The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
ServiceName Changes to this property will trigger replacement. string
The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
Type string
User account type, such as primary or regular account.
Username Changes to this property will trigger replacement. string
The name of the MySQL service user. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
accessCert String
Access certificate for the user.
accessKey String
Access certificate key for the user.
authentication String
Authentication details. The possible values are caching_sha2_password, mysql_native_password and null.
password String
The password of the MySQL service user.
project Changes to this property will trigger replacement. String
The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
serviceName Changes to this property will trigger replacement. String
The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
type String
User account type, such as primary or regular account.
username Changes to this property will trigger replacement. String
The name of the MySQL service user. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
accessCert string
Access certificate for the user.
accessKey string
Access certificate key for the user.
authentication string
Authentication details. The possible values are caching_sha2_password, mysql_native_password and null.
password string
The password of the MySQL service user.
project Changes to this property will trigger replacement. string
The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
serviceName Changes to this property will trigger replacement. string
The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
type string
User account type, such as primary or regular account.
username Changes to this property will trigger replacement. string
The name of the MySQL service user. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
access_cert str
Access certificate for the user.
access_key str
Access certificate key for the user.
authentication str
Authentication details. The possible values are caching_sha2_password, mysql_native_password and null.
password str
The password of the MySQL service user.
project Changes to this property will trigger replacement. str
The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
service_name Changes to this property will trigger replacement. str
The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
type str
User account type, such as primary or regular account.
username Changes to this property will trigger replacement. str
The name of the MySQL service user. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
accessCert String
Access certificate for the user.
accessKey String
Access certificate key for the user.
authentication String
Authentication details. The possible values are caching_sha2_password, mysql_native_password and null.
password String
The password of the MySQL service user.
project Changes to this property will trigger replacement. String
The name of the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
serviceName Changes to this property will trigger replacement. String
The name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
type String
User account type, such as primary or regular account.
username Changes to this property will trigger replacement. String
The name of the MySQL service user. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.

Import

$ pulumi import aiven:index/mysqlUser:MysqlUser foo PROJECT/SERVICE_NAME/USERNAME
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
Aiven pulumi/pulumi-aiven
License
Apache-2.0
Notes
This Pulumi package is based on the aiven Terraform Provider.