DatabaseArgs

data class DatabaseArgs(val charset: Output<String>? = null, val collation: Output<String>? = null, val name: Output<String>? = null, val resourceGroupName: Output<String>? = null, val serverName: Output<String>? = null) : ConvertibleToJava<DatabaseArgs>

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const example = new azure.core.ResourceGroup("example", {
name: "example-resources",
location: "West Europe",
});
const exampleServer = new azure.mysql.Server("example", {
name: "example-mysqlserver",
location: example.location,
resourceGroupName: example.name,
administratorLogin: "mysqladminun",
administratorLoginPassword: "H@Sh1CoR3!",
skuName: "GP_Gen5_2",
storageMb: 5120,
version: "5.7",
autoGrowEnabled: true,
backupRetentionDays: 7,
geoRedundantBackupEnabled: true,
infrastructureEncryptionEnabled: true,
publicNetworkAccessEnabled: false,
sslEnforcementEnabled: true,
sslMinimalTlsVersionEnforced: "TLS1_2",
});
const exampleDatabase = new azure.mysql.Database("example", {
name: "exampledb",
resourceGroupName: example.name,
serverName: exampleServer.name,
charset: "utf8",
collation: "utf8_unicode_ci",
});
import pulumi
import pulumi_azure as azure
example = azure.core.ResourceGroup("example",
name="example-resources",
location="West Europe")
example_server = azure.mysql.Server("example",
name="example-mysqlserver",
location=example.location,
resource_group_name=example.name,
administrator_login="mysqladminun",
administrator_login_password="H@Sh1CoR3!",
sku_name="GP_Gen5_2",
storage_mb=5120,
version="5.7",
auto_grow_enabled=True,
backup_retention_days=7,
geo_redundant_backup_enabled=True,
infrastructure_encryption_enabled=True,
public_network_access_enabled=False,
ssl_enforcement_enabled=True,
ssl_minimal_tls_version_enforced="TLS1_2")
example_database = azure.mysql.Database("example",
name="exampledb",
resource_group_name=example.name,
server_name=example_server.name,
charset="utf8",
collation="utf8_unicode_ci")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() =>
{
var example = new Azure.Core.ResourceGroup("example", new()
{
Name = "example-resources",
Location = "West Europe",
});
var exampleServer = new Azure.MySql.Server("example", new()
{
Name = "example-mysqlserver",
Location = example.Location,
ResourceGroupName = example.Name,
AdministratorLogin = "mysqladminun",
AdministratorLoginPassword = "H@Sh1CoR3!",
SkuName = "GP_Gen5_2",
StorageMb = 5120,
Version = "5.7",
AutoGrowEnabled = true,
BackupRetentionDays = 7,
GeoRedundantBackupEnabled = true,
InfrastructureEncryptionEnabled = true,
PublicNetworkAccessEnabled = false,
SslEnforcementEnabled = true,
SslMinimalTlsVersionEnforced = "TLS1_2",
});
var exampleDatabase = new Azure.MySql.Database("example", new()
{
Name = "exampledb",
ResourceGroupName = example.Name,
ServerName = exampleServer.Name,
Charset = "utf8",
Collation = "utf8_unicode_ci",
});
});
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/mysql"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
Name: pulumi.String("example-resources"),
Location: pulumi.String("West Europe"),
})
if err != nil {
return err
}
exampleServer, err := mysql.NewServer(ctx, "example", &mysql.ServerArgs{
Name: pulumi.String("example-mysqlserver"),
Location: example.Location,
ResourceGroupName: example.Name,
AdministratorLogin: pulumi.String("mysqladminun"),
AdministratorLoginPassword: pulumi.String("H@Sh1CoR3!"),
SkuName: pulumi.String("GP_Gen5_2"),
StorageMb: pulumi.Int(5120),
Version: pulumi.String("5.7"),
AutoGrowEnabled: pulumi.Bool(true),
BackupRetentionDays: pulumi.Int(7),
GeoRedundantBackupEnabled: pulumi.Bool(true),
InfrastructureEncryptionEnabled: pulumi.Bool(true),
PublicNetworkAccessEnabled: pulumi.Bool(false),
SslEnforcementEnabled: pulumi.Bool(true),
SslMinimalTlsVersionEnforced: pulumi.String("TLS1_2"),
})
if err != nil {
return err
}
_, err = mysql.NewDatabase(ctx, "example", &mysql.DatabaseArgs{
Name: pulumi.String("exampledb"),
ResourceGroupName: example.Name,
ServerName: exampleServer.Name,
Charset: pulumi.String("utf8"),
Collation: pulumi.String("utf8_unicode_ci"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.mysql.Server;
import com.pulumi.azure.mysql.ServerArgs;
import com.pulumi.azure.mysql.Database;
import com.pulumi.azure.mysql.DatabaseArgs;
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 example = new ResourceGroup("example", ResourceGroupArgs.builder()
.name("example-resources")
.location("West Europe")
.build());
var exampleServer = new Server("exampleServer", ServerArgs.builder()
.name("example-mysqlserver")
.location(example.location())
.resourceGroupName(example.name())
.administratorLogin("mysqladminun")
.administratorLoginPassword("H@Sh1CoR3!")
.skuName("GP_Gen5_2")
.storageMb(5120)
.version("5.7")
.autoGrowEnabled(true)
.backupRetentionDays(7)
.geoRedundantBackupEnabled(true)
.infrastructureEncryptionEnabled(true)
.publicNetworkAccessEnabled(false)
.sslEnforcementEnabled(true)
.sslMinimalTlsVersionEnforced("TLS1_2")
.build());
var exampleDatabase = new Database("exampleDatabase", DatabaseArgs.builder()
.name("exampledb")
.resourceGroupName(example.name())
.serverName(exampleServer.name())
.charset("utf8")
.collation("utf8_unicode_ci")
.build());
}
}
resources:
example:
type: azure:core:ResourceGroup
properties:
name: example-resources
location: West Europe
exampleServer:
type: azure:mysql:Server
name: example
properties:
name: example-mysqlserver
location: ${example.location}
resourceGroupName: ${example.name}
administratorLogin: mysqladminun
administratorLoginPassword: H@Sh1CoR3!
skuName: GP_Gen5_2
storageMb: 5120
version: '5.7'
autoGrowEnabled: true
backupRetentionDays: 7
geoRedundantBackupEnabled: true
infrastructureEncryptionEnabled: true
publicNetworkAccessEnabled: false
sslEnforcementEnabled: true
sslMinimalTlsVersionEnforced: TLS1_2
exampleDatabase:
type: azure:mysql:Database
name: example
properties:
name: exampledb
resourceGroupName: ${example.name}
serverName: ${exampleServer.name}
charset: utf8
collation: utf8_unicode_ci

Import

MySQL Database's can be imported using the resource id, e.g.

$ pulumi import azure:mysql/database:Database database1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.DBforMySQL/servers/server1/databases/database1

Constructors

Link copied to clipboard
constructor(charset: Output<String>? = null, collation: Output<String>? = null, name: Output<String>? = null, resourceGroupName: Output<String>? = null, serverName: Output<String>? = null)

Properties

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

Specifies the Charset for the MySQL Database, which needs to be a valid MySQL Charset. Changing this forces a new resource to be created.

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

Specifies the Collation for the MySQL Database, which needs to be a valid MySQL Collation. Changing this forces a new resource to be created.

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

Specifies the name of the MySQL Database, which needs to be a valid MySQL identifier. Changing this forces a new resource to be created.

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

The name of the resource group in which the MySQL Server exists. Changing this forces a new resource to be created.

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

Specifies the name of the MySQL Server. Changing this forces a new resource to be created.

Functions

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