Database
Manages a MySQL Database within a MySQL Server
Example Usage
using Pulumi;
using Azure = Pulumi.Azure;
class MyStack : Stack
{
public MyStack()
{
var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new Azure.Core.ResourceGroupArgs
{
Location = "West Europe",
});
var exampleServer = new Azure.MySql.Server("exampleServer", new Azure.MySql.ServerArgs
{
Location = exampleResourceGroup.Location,
ResourceGroupName = exampleResourceGroup.Name,
AdministratorLogin = "mysqladminun",
AdministratorLoginPassword = "H@Sh1CoR3!",
SkuName = "B_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("exampleDatabase", new Azure.MySql.DatabaseArgs
{
ResourceGroupName = exampleResourceGroup.Name,
ServerName = exampleServer.Name,
Charset = "utf8",
Collation = "utf8_unicode_ci",
});
}
}
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v3/go/azure/core"
"github.com/pulumi/pulumi-azure/sdk/v3/go/azure/mysql"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
Location: pulumi.String("West Europe"),
})
if err != nil {
return err
}
exampleServer, err := mysql.NewServer(ctx, "exampleServer", &mysql.ServerArgs{
Location: exampleResourceGroup.Location,
ResourceGroupName: exampleResourceGroup.Name,
AdministratorLogin: pulumi.String("mysqladminun"),
AdministratorLoginPassword: pulumi.String("H@Sh1CoR3!"),
SkuName: pulumi.String("B_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, "exampleDatabase", &mysql.DatabaseArgs{
ResourceGroupName: exampleResourceGroup.Name,
ServerName: exampleServer.Name,
Charset: pulumi.String("utf8"),
Collation: pulumi.String("utf8_unicode_ci"),
})
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_azure as azure
example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
example_server = azure.mysql.Server("exampleServer",
location=example_resource_group.location,
resource_group_name=example_resource_group.name,
administrator_login="mysqladminun",
administrator_login_password="H@Sh1CoR3!",
sku_name="B_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("exampleDatabase",
resource_group_name=example_resource_group.name,
server_name=example_server.name,
charset="utf8",
collation="utf8_unicode_ci")import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West Europe"});
const exampleServer = new azure.mysql.Server("exampleServer", {
location: exampleResourceGroup.location,
resourceGroupName: exampleResourceGroup.name,
administratorLogin: "mysqladminun",
administratorLoginPassword: "H@Sh1CoR3!",
skuName: "B_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("exampleDatabase", {
resourceGroupName: exampleResourceGroup.name,
serverName: exampleServer.name,
charset: "utf8",
collation: "utf8_unicode_ci",
});Create a Database Resource
new Database(name: string, args: DatabaseArgs, opts?: CustomResourceOptions);def Database(resource_name, opts=None, charset=None, collation=None, name=None, resource_group_name=None, server_name=None, __props__=None);func NewDatabase(ctx *Context, name string, args DatabaseArgs, opts ...ResourceOption) (*Database, error)public Database(string name, DatabaseArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args DatabaseArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args DatabaseArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args DatabaseArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
Database Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The Database resource accepts the following input properties:
- Charset string
Specifies the Charset for the MySQL Database, which needs to be a valid MySQL Charset. Changing this forces a new resource to be created.
- Collation string
Specifies the Collation for the MySQL Database, which needs to be a valid MySQL Collation. Changing this forces a new resource to be created.
- Resource
Group stringName The name of the resource group in which the MySQL Server exists. Changing this forces a new resource to be created.
- Server
Name string Specifies the name of the MySQL Server. Changing this forces a new resource to be created.
- Name string
Specifies the name of the MySQL Database, which needs to be a valid MySQL identifier. Changing this forces a new resource to be created.
- Charset string
Specifies the Charset for the MySQL Database, which needs to be a valid MySQL Charset. Changing this forces a new resource to be created.
- Collation string
Specifies the Collation for the MySQL Database, which needs to be a valid MySQL Collation. Changing this forces a new resource to be created.
- Resource
Group stringName The name of the resource group in which the MySQL Server exists. Changing this forces a new resource to be created.
- Server
Name string Specifies the name of the MySQL Server. Changing this forces a new resource to be created.
- Name string
Specifies the name of the MySQL Database, which needs to be a valid MySQL identifier. Changing this forces a new resource to be created.
- charset string
Specifies the Charset for the MySQL Database, which needs to be a valid MySQL Charset. Changing this forces a new resource to be created.
- collation string
Specifies the Collation for the MySQL Database, which needs to be a valid MySQL Collation. Changing this forces a new resource to be created.
- resource
Group stringName The name of the resource group in which the MySQL Server exists. Changing this forces a new resource to be created.
- server
Name string Specifies the name of the MySQL Server. Changing this forces a new resource to be created.
- name string
Specifies the name of the MySQL Database, which needs to be a valid MySQL identifier. Changing this forces a new resource to be created.
- charset str
Specifies the Charset for the MySQL Database, which needs to be a valid MySQL Charset. Changing this forces a new resource to be created.
- collation str
Specifies the Collation for the MySQL Database, which needs to be a valid MySQL Collation. Changing this forces a new resource to be created.
- resource_
group_ strname The name of the resource group in which the MySQL Server exists. Changing this forces a new resource to be created.
- server_
name str Specifies the name of the MySQL Server. Changing this forces a new resource to be created.
- name str
Specifies the name of the MySQL Database, which needs to be a valid MySQL identifier. Changing this forces a new resource to be created.
Outputs
All input properties are implicitly available as output properties. Additionally, the Database resource produces the following output properties:
Look up an Existing Database Resource
Get an existing Database 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?: DatabaseState, opts?: CustomResourceOptions): Databasestatic get(resource_name, id, opts=None, charset=None, collation=None, name=None, resource_group_name=None, server_name=None, __props__=None);func GetDatabase(ctx *Context, name string, id IDInput, state *DatabaseState, opts ...ResourceOption) (*Database, error)public static Database Get(string name, Input<string> id, DatabaseState? state, CustomResourceOptions? opts = null)- 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.
The following state arguments are supported:
- Charset string
Specifies the Charset for the MySQL Database, which needs to be a valid MySQL Charset. Changing this forces a new resource to be created.
- Collation string
Specifies the Collation for the MySQL Database, which needs to be a valid MySQL Collation. Changing this forces a new resource to be created.
- Name string
Specifies the name of the MySQL Database, which needs to be a valid MySQL identifier. Changing this forces a new resource to be created.
- Resource
Group stringName The name of the resource group in which the MySQL Server exists. Changing this forces a new resource to be created.
- Server
Name string Specifies the name of the MySQL Server. Changing this forces a new resource to be created.
- Charset string
Specifies the Charset for the MySQL Database, which needs to be a valid MySQL Charset. Changing this forces a new resource to be created.
- Collation string
Specifies the Collation for the MySQL Database, which needs to be a valid MySQL Collation. Changing this forces a new resource to be created.
- Name string
Specifies the name of the MySQL Database, which needs to be a valid MySQL identifier. Changing this forces a new resource to be created.
- Resource
Group stringName The name of the resource group in which the MySQL Server exists. Changing this forces a new resource to be created.
- Server
Name string Specifies the name of the MySQL Server. Changing this forces a new resource to be created.
- charset string
Specifies the Charset for the MySQL Database, which needs to be a valid MySQL Charset. Changing this forces a new resource to be created.
- collation string
Specifies the Collation for the MySQL Database, which needs to be a valid MySQL Collation. Changing this forces a new resource to be created.
- name string
Specifies the name of the MySQL Database, which needs to be a valid MySQL identifier. Changing this forces a new resource to be created.
- resource
Group stringName The name of the resource group in which the MySQL Server exists. Changing this forces a new resource to be created.
- server
Name string Specifies the name of the MySQL Server. Changing this forces a new resource to be created.
- charset str
Specifies the Charset for the MySQL Database, which needs to be a valid MySQL Charset. Changing this forces a new resource to be created.
- collation str
Specifies the Collation for the MySQL Database, which needs to be a valid MySQL Collation. Changing this forces a new resource to be created.
- name str
Specifies the name of the MySQL Database, which needs to be a valid MySQL identifier. Changing this forces a new resource to be created.
- resource_
group_ strname The name of the resource group in which the MySQL Server exists. Changing this forces a new resource to be created.
- server_
name str Specifies the name of the MySQL Server. Changing this forces a new resource to be created.
Package Details
- Repository
- https://github.com/pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
azurermTerraform Provider.