DatabaseArgs

data class DatabaseArgs(val collation: Output<String>? = null, val createMode: Output<String>? = null, val edition: Output<String>? = null, val elasticPoolName: Output<String>? = null, val import: Output<DatabaseImportArgs>? = null, val location: Output<String>? = null, val maxSizeBytes: Output<String>? = null, val maxSizeGb: Output<String>? = null, val name: Output<String>? = null, val readScale: Output<Boolean>? = null, val requestedServiceObjectiveId: Output<String>? = null, val requestedServiceObjectiveName: Output<String>? = null, val resourceGroupName: Output<String>? = null, val restorePointInTime: Output<String>? = null, val serverName: Output<String>? = null, val sourceDatabaseDeletionDate: Output<String>? = null, val sourceDatabaseId: Output<String>? = null, val tags: Output<Map<String, String>>? = null, val threatDetectionPolicy: Output<DatabaseThreatDetectionPolicyArgs>? = null, val zoneRedundant: Output<Boolean>? = null) : ConvertibleToJava<DatabaseArgs>

Allows you to manage an Azure SQL Database

Note: The azure.sql.Database resource is deprecated in version 3.0 of the AzureRM provider and will be removed in version 4.0. Please use the azure.mssql.Database resource instead.

Example Usage

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.sql.SqlServer;
import com.pulumi.azure.sql.SqlServerArgs;
import com.pulumi.azure.storage.Account;
import com.pulumi.azure.storage.AccountArgs;
import com.pulumi.azure.sql.Database;
import com.pulumi.azure.sql.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 exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()
.location("West Europe")
.build());
var exampleSqlServer = new SqlServer("exampleSqlServer", SqlServerArgs.builder()
.resourceGroupName(exampleResourceGroup.name())
.location(exampleResourceGroup.location())
.version("12.0")
.administratorLogin("4dm1n157r470r")
.administratorLoginPassword("4-v3ry-53cr37-p455w0rd")
.tags(Map.of("environment", "production"))
.build());
var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
.resourceGroupName(exampleResourceGroup.name())
.location(exampleResourceGroup.location())
.accountTier("Standard")
.accountReplicationType("LRS")
.build());
var exampleDatabase = new Database("exampleDatabase", DatabaseArgs.builder()
.resourceGroupName(exampleResourceGroup.name())
.location(exampleResourceGroup.location())
.serverName(exampleSqlServer.name())
.tags(Map.of("environment", "production"))
.build());
}
}

Import

SQL Databases can be imported using the resource id, e.g.

$ pulumi import azure:sql/database:Database database1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/providers/Microsoft.Sql/servers/myserver/databases/database1

Constructors

Link copied to clipboard
fun DatabaseArgs(collation: Output<String>? = null, createMode: Output<String>? = null, edition: Output<String>? = null, elasticPoolName: Output<String>? = null, import: Output<DatabaseImportArgs>? = null, location: Output<String>? = null, maxSizeBytes: Output<String>? = null, maxSizeGb: Output<String>? = null, name: Output<String>? = null, readScale: Output<Boolean>? = null, requestedServiceObjectiveId: Output<String>? = null, requestedServiceObjectiveName: Output<String>? = null, resourceGroupName: Output<String>? = null, restorePointInTime: Output<String>? = null, serverName: Output<String>? = null, sourceDatabaseDeletionDate: Output<String>? = null, sourceDatabaseId: Output<String>? = null, tags: Output<Map<String, String>>? = null, threatDetectionPolicy: Output<DatabaseThreatDetectionPolicyArgs>? = null, zoneRedundant: Output<Boolean>? = null)

Functions

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

Properties

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

The name of the collation. Applies only if create_mode is Default. Azure default is SQL_LATIN1_GENERAL_CP1_CI_AS. Changing this forces a new resource to be created.

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

Specifies how to create the database. Valid values are: Default, Copy, OnlineSecondary, NonReadableSecondary, PointInTimeRestore, Recovery, Restore or RestoreLongTermRetentionBackup. Must be Default to create a new database. Defaults to Default. Please see Azure SQL Database REST API

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

The edition of the database to be created. Applies only if create_mode is Default. Valid values are: Basic, Standard, Premium, DataWarehouse, Business, BusinessCritical, Free, GeneralPurpose, Hyperscale, Premium, PremiumRS, Standard, Stretch, System, System2, or Web. Please see Azure SQL database models.

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

The name of the elastic database pool.

Link copied to clipboard
val import: Output<DatabaseImportArgs>? = null

A Database Import block as documented below. create_mode must be set to Default.

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

Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.

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

The maximum size that the database can grow to. Applies only if create_mode is Default. Please see Azure SQL database models.

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

The name of the database. Changing this forces a new resource to be created.

Link copied to clipboard
val readScale: Output<Boolean>? = null

Read-only connections will be redirected to a high-available replica. Please see Use read-only replicas to load-balance read-only query workloads.

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

A GUID/UUID corresponding to a configured Service Level Objective for the Azure SQL database which can be used to configure a performance level. .

Link copied to clipboard

The service objective name for the database. Valid values depend on edition and location and may include S0, S1, S2, S3, P1, P2, P4, P6, P11 and ElasticPool. You can list the available names with the CLI: shell az sql db list-editions -l westus -o table. For further information please see Azure CLI - az sql db.

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

The name of the resource group in which to create the database. This must be the same as Database Server resource group currently. Changing this forces a new resource to be created.

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

The point in time for the restore. Only applies if create_mode is PointInTimeRestore, it should be provided in RFC3339 format, e.g. 2013-11-08T22:00:40Z.

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

The name of the SQL Server on which to create the database. Changing this forces a new resource to be created.

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

The deletion date time of the source database. Only applies to deleted databases where create_mode is PointInTimeRestore.

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

The URI of the source database if create_mode value is not Default.

Link copied to clipboard
val tags: Output<Map<String, String>>? = null

A mapping of tags to assign to the resource.

Link copied to clipboard

Threat detection policy configuration. The threat_detection_policy block supports fields documented below.

Link copied to clipboard
val zoneRedundant: Output<Boolean>? = null

Whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones.