1. Packages
  2. Azure Classic
  3. API Docs
  4. mariadb
  5. Database

We recommend using Azure Native.

Azure Classic v5.81.0 published on Monday, Jun 24, 2024 by Pulumi

azure.mariadb.Database

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure Classic v5.81.0 published on Monday, Jun 24, 2024 by Pulumi

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const example = new azure.core.ResourceGroup("example", {
        name: "tfex-mariadb-database-RG",
        location: "West Europe",
    });
    const exampleServer = new azure.mariadb.Server("example", {
        name: "mariadb-svr",
        location: example.location,
        resourceGroupName: example.name,
        skuName: "B_Gen5_2",
        storageMb: 51200,
        backupRetentionDays: 7,
        geoRedundantBackupEnabled: false,
        administratorLogin: "acctestun",
        administratorLoginPassword: "H@Sh1CoR3!",
        version: "10.2",
        sslEnforcementEnabled: true,
    });
    const exampleDatabase = new azure.mariadb.Database("example", {
        name: "mariadb_database",
        resourceGroupName: example.name,
        serverName: exampleServer.name,
        charset: "utf8mb4",
        collation: "utf8mb4_unicode_520_ci",
    });
    
    import pulumi
    import pulumi_azure as azure
    
    example = azure.core.ResourceGroup("example",
        name="tfex-mariadb-database-RG",
        location="West Europe")
    example_server = azure.mariadb.Server("example",
        name="mariadb-svr",
        location=example.location,
        resource_group_name=example.name,
        sku_name="B_Gen5_2",
        storage_mb=51200,
        backup_retention_days=7,
        geo_redundant_backup_enabled=False,
        administrator_login="acctestun",
        administrator_login_password="H@Sh1CoR3!",
        version="10.2",
        ssl_enforcement_enabled=True)
    example_database = azure.mariadb.Database("example",
        name="mariadb_database",
        resource_group_name=example.name,
        server_name=example_server.name,
        charset="utf8mb4",
        collation="utf8mb4_unicode_520_ci")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/mariadb"
    	"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("tfex-mariadb-database-RG"),
    			Location: pulumi.String("West Europe"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleServer, err := mariadb.NewServer(ctx, "example", &mariadb.ServerArgs{
    			Name:                       pulumi.String("mariadb-svr"),
    			Location:                   example.Location,
    			ResourceGroupName:          example.Name,
    			SkuName:                    pulumi.String("B_Gen5_2"),
    			StorageMb:                  pulumi.Int(51200),
    			BackupRetentionDays:        pulumi.Int(7),
    			GeoRedundantBackupEnabled:  pulumi.Bool(false),
    			AdministratorLogin:         pulumi.String("acctestun"),
    			AdministratorLoginPassword: pulumi.String("H@Sh1CoR3!"),
    			Version:                    pulumi.String("10.2"),
    			SslEnforcementEnabled:      pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = mariadb.NewDatabase(ctx, "example", &mariadb.DatabaseArgs{
    			Name:              pulumi.String("mariadb_database"),
    			ResourceGroupName: example.Name,
    			ServerName:        exampleServer.Name,
    			Charset:           pulumi.String("utf8mb4"),
    			Collation:         pulumi.String("utf8mb4_unicode_520_ci"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    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 = "tfex-mariadb-database-RG",
            Location = "West Europe",
        });
    
        var exampleServer = new Azure.MariaDB.Server("example", new()
        {
            Name = "mariadb-svr",
            Location = example.Location,
            ResourceGroupName = example.Name,
            SkuName = "B_Gen5_2",
            StorageMb = 51200,
            BackupRetentionDays = 7,
            GeoRedundantBackupEnabled = false,
            AdministratorLogin = "acctestun",
            AdministratorLoginPassword = "H@Sh1CoR3!",
            Version = "10.2",
            SslEnforcementEnabled = true,
        });
    
        var exampleDatabase = new Azure.MariaDB.Database("example", new()
        {
            Name = "mariadb_database",
            ResourceGroupName = example.Name,
            ServerName = exampleServer.Name,
            Charset = "utf8mb4",
            Collation = "utf8mb4_unicode_520_ci",
        });
    
    });
    
    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.mariadb.Server;
    import com.pulumi.azure.mariadb.ServerArgs;
    import com.pulumi.azure.mariadb.Database;
    import com.pulumi.azure.mariadb.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("tfex-mariadb-database-RG")
                .location("West Europe")
                .build());
    
            var exampleServer = new Server("exampleServer", ServerArgs.builder()
                .name("mariadb-svr")
                .location(example.location())
                .resourceGroupName(example.name())
                .skuName("B_Gen5_2")
                .storageMb(51200)
                .backupRetentionDays(7)
                .geoRedundantBackupEnabled(false)
                .administratorLogin("acctestun")
                .administratorLoginPassword("H@Sh1CoR3!")
                .version("10.2")
                .sslEnforcementEnabled(true)
                .build());
    
            var exampleDatabase = new Database("exampleDatabase", DatabaseArgs.builder()
                .name("mariadb_database")
                .resourceGroupName(example.name())
                .serverName(exampleServer.name())
                .charset("utf8mb4")
                .collation("utf8mb4_unicode_520_ci")
                .build());
    
        }
    }
    
    resources:
      example:
        type: azure:core:ResourceGroup
        properties:
          name: tfex-mariadb-database-RG
          location: West Europe
      exampleServer:
        type: azure:mariadb:Server
        name: example
        properties:
          name: mariadb-svr
          location: ${example.location}
          resourceGroupName: ${example.name}
          skuName: B_Gen5_2
          storageMb: 51200
          backupRetentionDays: 7
          geoRedundantBackupEnabled: false
          administratorLogin: acctestun
          administratorLoginPassword: H@Sh1CoR3!
          version: '10.2'
          sslEnforcementEnabled: true
      exampleDatabase:
        type: azure:mariadb:Database
        name: example
        properties:
          name: mariadb_database
          resourceGroupName: ${example.name}
          serverName: ${exampleServer.name}
          charset: utf8mb4
          collation: utf8mb4_unicode_520_ci
    

    Create Database Resource

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

    Constructor syntax

    new Database(name: string, args: DatabaseArgs, opts?: CustomResourceOptions);
    @overload
    def Database(resource_name: str,
                 args: DatabaseArgs,
                 opts: Optional[ResourceOptions] = None)
    
    @overload
    def Database(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 charset: Optional[str] = None,
                 collation: Optional[str] = None,
                 resource_group_name: Optional[str] = None,
                 server_name: Optional[str] = None,
                 name: Optional[str] = None)
    func NewDatabase(ctx *Context, name string, args DatabaseArgs, opts ...ResourceOption) (*Database, error)
    public Database(string name, DatabaseArgs args, CustomResourceOptions? opts = null)
    public Database(String name, DatabaseArgs args)
    public Database(String name, DatabaseArgs args, CustomResourceOptions options)
    
    type: azure:mariadb:Database
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    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.
    args DatabaseArgs
    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 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.
    name String
    The unique name of the resource.
    args DatabaseArgs
    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 azureDatabaseResource = new Azure.MariaDB.Database("azureDatabaseResource", new()
    {
        Charset = "string",
        Collation = "string",
        ResourceGroupName = "string",
        ServerName = "string",
        Name = "string",
    });
    
    example, err := mariadb.NewDatabase(ctx, "azureDatabaseResource", &mariadb.DatabaseArgs{
    	Charset:           pulumi.String("string"),
    	Collation:         pulumi.String("string"),
    	ResourceGroupName: pulumi.String("string"),
    	ServerName:        pulumi.String("string"),
    	Name:              pulumi.String("string"),
    })
    
    var azureDatabaseResource = new Database("azureDatabaseResource", DatabaseArgs.builder()
        .charset("string")
        .collation("string")
        .resourceGroupName("string")
        .serverName("string")
        .name("string")
        .build());
    
    azure_database_resource = azure.mariadb.Database("azureDatabaseResource",
        charset="string",
        collation="string",
        resource_group_name="string",
        server_name="string",
        name="string")
    
    const azureDatabaseResource = new azure.mariadb.Database("azureDatabaseResource", {
        charset: "string",
        collation: "string",
        resourceGroupName: "string",
        serverName: "string",
        name: "string",
    });
    
    type: azure:mariadb:Database
    properties:
        charset: string
        collation: string
        name: string
        resourceGroupName: string
        serverName: string
    

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

    Charset string
    Specifies the Charset for the MariaDB Database, which needs to be a valid MariaDB Charset. Changing this forces a new resource to be created.
    Collation string
    Specifies the Collation for the MariaDB Database, which needs to be a valid MariaDB Collation. Changing this forces a new resource to be created.
    ResourceGroupName string
    The name of the resource group in which the MariaDB Server exists. Changing this forces a new resource to be created.
    ServerName string
    Specifies the name of the MariaDB Server. Changing this forces a new resource to be created.
    Name string
    Specifies the name of the MariaDB Database, which needs to be a valid MariaDB identifier. Changing this forces a new resource to be created.
    Charset string
    Specifies the Charset for the MariaDB Database, which needs to be a valid MariaDB Charset. Changing this forces a new resource to be created.
    Collation string
    Specifies the Collation for the MariaDB Database, which needs to be a valid MariaDB Collation. Changing this forces a new resource to be created.
    ResourceGroupName string
    The name of the resource group in which the MariaDB Server exists. Changing this forces a new resource to be created.
    ServerName string
    Specifies the name of the MariaDB Server. Changing this forces a new resource to be created.
    Name string
    Specifies the name of the MariaDB Database, which needs to be a valid MariaDB identifier. Changing this forces a new resource to be created.
    charset String
    Specifies the Charset for the MariaDB Database, which needs to be a valid MariaDB Charset. Changing this forces a new resource to be created.
    collation String
    Specifies the Collation for the MariaDB Database, which needs to be a valid MariaDB Collation. Changing this forces a new resource to be created.
    resourceGroupName String
    The name of the resource group in which the MariaDB Server exists. Changing this forces a new resource to be created.
    serverName String
    Specifies the name of the MariaDB Server. Changing this forces a new resource to be created.
    name String
    Specifies the name of the MariaDB Database, which needs to be a valid MariaDB identifier. Changing this forces a new resource to be created.
    charset string
    Specifies the Charset for the MariaDB Database, which needs to be a valid MariaDB Charset. Changing this forces a new resource to be created.
    collation string
    Specifies the Collation for the MariaDB Database, which needs to be a valid MariaDB Collation. Changing this forces a new resource to be created.
    resourceGroupName string
    The name of the resource group in which the MariaDB Server exists. Changing this forces a new resource to be created.
    serverName string
    Specifies the name of the MariaDB Server. Changing this forces a new resource to be created.
    name string
    Specifies the name of the MariaDB Database, which needs to be a valid MariaDB identifier. Changing this forces a new resource to be created.
    charset str
    Specifies the Charset for the MariaDB Database, which needs to be a valid MariaDB Charset. Changing this forces a new resource to be created.
    collation str
    Specifies the Collation for the MariaDB Database, which needs to be a valid MariaDB Collation. Changing this forces a new resource to be created.
    resource_group_name str
    The name of the resource group in which the MariaDB Server exists. Changing this forces a new resource to be created.
    server_name str
    Specifies the name of the MariaDB Server. Changing this forces a new resource to be created.
    name str
    Specifies the name of the MariaDB Database, which needs to be a valid MariaDB identifier. Changing this forces a new resource to be created.
    charset String
    Specifies the Charset for the MariaDB Database, which needs to be a valid MariaDB Charset. Changing this forces a new resource to be created.
    collation String
    Specifies the Collation for the MariaDB Database, which needs to be a valid MariaDB Collation. Changing this forces a new resource to be created.
    resourceGroupName String
    The name of the resource group in which the MariaDB Server exists. Changing this forces a new resource to be created.
    serverName String
    Specifies the name of the MariaDB Server. Changing this forces a new resource to be created.
    name String
    Specifies the name of the MariaDB Database, which needs to be a valid MariaDB 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:

    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 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): Database
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            charset: Optional[str] = None,
            collation: Optional[str] = None,
            name: Optional[str] = None,
            resource_group_name: Optional[str] = None,
            server_name: Optional[str] = None) -> Database
    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)
    public static Database get(String name, Output<String> id, DatabaseState 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.
    The following state arguments are supported:
    Charset string
    Specifies the Charset for the MariaDB Database, which needs to be a valid MariaDB Charset. Changing this forces a new resource to be created.
    Collation string
    Specifies the Collation for the MariaDB Database, which needs to be a valid MariaDB Collation. Changing this forces a new resource to be created.
    Name string
    Specifies the name of the MariaDB Database, which needs to be a valid MariaDB identifier. Changing this forces a new resource to be created.
    ResourceGroupName string
    The name of the resource group in which the MariaDB Server exists. Changing this forces a new resource to be created.
    ServerName string
    Specifies the name of the MariaDB Server. Changing this forces a new resource to be created.
    Charset string
    Specifies the Charset for the MariaDB Database, which needs to be a valid MariaDB Charset. Changing this forces a new resource to be created.
    Collation string
    Specifies the Collation for the MariaDB Database, which needs to be a valid MariaDB Collation. Changing this forces a new resource to be created.
    Name string
    Specifies the name of the MariaDB Database, which needs to be a valid MariaDB identifier. Changing this forces a new resource to be created.
    ResourceGroupName string
    The name of the resource group in which the MariaDB Server exists. Changing this forces a new resource to be created.
    ServerName string
    Specifies the name of the MariaDB Server. Changing this forces a new resource to be created.
    charset String
    Specifies the Charset for the MariaDB Database, which needs to be a valid MariaDB Charset. Changing this forces a new resource to be created.
    collation String
    Specifies the Collation for the MariaDB Database, which needs to be a valid MariaDB Collation. Changing this forces a new resource to be created.
    name String
    Specifies the name of the MariaDB Database, which needs to be a valid MariaDB identifier. Changing this forces a new resource to be created.
    resourceGroupName String
    The name of the resource group in which the MariaDB Server exists. Changing this forces a new resource to be created.
    serverName String
    Specifies the name of the MariaDB Server. Changing this forces a new resource to be created.
    charset string
    Specifies the Charset for the MariaDB Database, which needs to be a valid MariaDB Charset. Changing this forces a new resource to be created.
    collation string
    Specifies the Collation for the MariaDB Database, which needs to be a valid MariaDB Collation. Changing this forces a new resource to be created.
    name string
    Specifies the name of the MariaDB Database, which needs to be a valid MariaDB identifier. Changing this forces a new resource to be created.
    resourceGroupName string
    The name of the resource group in which the MariaDB Server exists. Changing this forces a new resource to be created.
    serverName string
    Specifies the name of the MariaDB Server. Changing this forces a new resource to be created.
    charset str
    Specifies the Charset for the MariaDB Database, which needs to be a valid MariaDB Charset. Changing this forces a new resource to be created.
    collation str
    Specifies the Collation for the MariaDB Database, which needs to be a valid MariaDB Collation. Changing this forces a new resource to be created.
    name str
    Specifies the name of the MariaDB Database, which needs to be a valid MariaDB identifier. Changing this forces a new resource to be created.
    resource_group_name str
    The name of the resource group in which the MariaDB Server exists. Changing this forces a new resource to be created.
    server_name str
    Specifies the name of the MariaDB Server. Changing this forces a new resource to be created.
    charset String
    Specifies the Charset for the MariaDB Database, which needs to be a valid MariaDB Charset. Changing this forces a new resource to be created.
    collation String
    Specifies the Collation for the MariaDB Database, which needs to be a valid MariaDB Collation. Changing this forces a new resource to be created.
    name String
    Specifies the name of the MariaDB Database, which needs to be a valid MariaDB identifier. Changing this forces a new resource to be created.
    resourceGroupName String
    The name of the resource group in which the MariaDB Server exists. Changing this forces a new resource to be created.
    serverName String
    Specifies the name of the MariaDB Server. Changing this forces a new resource to be created.

    Import

    MariaDB Database’s can be imported using the resource id, e.g.

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

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

    Package Details

    Repository
    Azure Classic pulumi/pulumi-azure
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the azurerm Terraform Provider.
    azure logo

    We recommend using Azure Native.

    Azure Classic v5.81.0 published on Monday, Jun 24, 2024 by Pulumi