import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * Manages a MS SQL Database. * * !> **Note:** To mitigate the possibility of accidental data loss it is highly recommended that you use the `preventDestroy` lifecycle argument in your configuration file for this resource. For more information on the `preventDestroy` lifecycle argument please see the terraform documentation. * * ## Example Usage * * ```typescript * 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.mssql.Server("example", { * name: "example-sqlserver", * resourceGroupName: example.name, * location: example.location, * version: "12.0", * administratorLogin: "4dm1n157r470r", * administratorLoginPassword: "4-v3ry-53cr37-p455w0rd", * }); * const exampleDatabase = new azure.mssql.Database("example", { * name: "example-db", * serverId: exampleServer.id, * collation: "SQL_Latin1_General_CP1_CI_AS", * licenseType: "LicenseIncluded", * maxSizeGb: 2, * skuName: "S0", * enclaveType: "VBS", * tags: { * foo: "bar", * }, * }); * ``` * * ### Transparent Data Encryption(TDE) With A Customer Managed Key(CMK) During Create * ```typescript * 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 exampleUserAssignedIdentity = new azure.authorization.UserAssignedIdentity("example", { * name: "example-admin", * location: example.location, * resourceGroupName: example.name, * }); * const exampleAccount = new azure.storage.Account("example", { * name: "examplesa", * resourceGroupName: example.name, * location: example.location, * accountTier: "Standard", * accountReplicationType: "LRS", * }); * const exampleServer = new azure.mssql.Server("example", { * name: "example-sqlserver", * resourceGroupName: example.name, * location: example.location, * version: "12.0", * administratorLogin: "4dm1n157r470r", * administratorLoginPassword: "4-v3ry-53cr37-p455w0rd", * }); * // Create a key vault with access policies which allow for the current user to get, list, create, delete, update, recover, purge and getRotationPolicy for the key vault key and also add a key vault access policy for the Microsoft Sql Server instance User Managed Identity to get, wrap, and unwrap key(s) * const exampleKeyVault = new azure.keyvault.KeyVault("example", { * name: "mssqltdeexample", * location: example.location, * resourceGroupName: example.name, * enabledForDiskEncryption: true, * tenantId: exampleUserAssignedIdentity.tenantId, * softDeleteRetentionDays: 7, * purgeProtectionEnabled: true, * skuName: "standard", * accessPolicies: [ * { * tenantId: current.tenantId, * objectId: current.objectId, * keyPermissions: [ * "Get", * "List", * "Create", * "Delete", * "Update", * "Recover", * "Purge", * "GetRotationPolicy", * ], * }, * { * tenantId: exampleUserAssignedIdentity.tenantId, * objectId: exampleUserAssignedIdentity.principalId, * keyPermissions: [ * "Get", * "WrapKey", * "UnwrapKey", * ], * }, * ], * }); * const exampleKey = new azure.keyvault.Key("example", { * name: "example-key", * keyVaultId: exampleKeyVault.id, * keyType: "RSA", * keySize: 2048, * keyOpts: [ * "unwrapKey", * "wrapKey", * ], * }, { * dependsOn: [exampleKeyVault], * }); * const exampleDatabase = new azure.mssql.Database("example", { * name: "example-db", * serverId: exampleServer.id, * collation: "SQL_Latin1_General_CP1_CI_AS", * licenseType: "LicenseIncluded", * maxSizeGb: 4, * readScale: true, * skuName: "S0", * zoneRedundant: true, * enclaveType: "VBS", * tags: { * foo: "bar", * }, * identity: { * type: "UserAssigned", * identityIds: [exampleUserAssignedIdentity.id], * }, * transparentDataEncryptionKeyVaultKeyId: exampleKey.id, * }); * ``` * * ## API Providers * * * This resource uses the following Azure API Providers: * * * `Microsoft.Sql` - 2023-08-01-preview * * ## Import * * SQL Database can be imported using the `resource id`, e.g. * * ```sh * $ pulumi import azure:mssql/database:Database example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/databases/example1 * ``` */ export declare class Database extends pulumi.CustomResource { /** * Get an existing Database resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input, state?: DatabaseState, opts?: pulumi.CustomResourceOptions): Database; /** * Returns true if the given object is an instance of Database. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is Database; /** * Time in minutes after which database is automatically paused. A value of `-1` means that automatic pause is disabled. This property is only settable for Serverless databases. */ readonly autoPauseDelayInMinutes: pulumi.Output; /** * Specifies the collation of the database. Changing this forces a new resource to be created. */ readonly collation: pulumi.Output; /** * The create mode of the database. Possible values are `Copy`, `Default`, `OnlineSecondary`, `PointInTimeRestore`, `Recovery`, `Restore`, `RestoreExternalBackup`, `RestoreExternalBackupSecondary`, `RestoreLongTermRetentionBackup` and `Secondary`. Mutually exclusive with `import`. Changing this forces a new resource to be created. Defaults to `Default`. */ readonly createMode: pulumi.Output; /** * The ID of the source database from which to create the new database. This should only be used for databases with `createMode` values that use another database as reference. Changing this forces a new resource to be created. * * > **Note:** When configuring a secondary database, please be aware of the constraints for the `skuName` property, as noted below, for both the primary and secondary databases. The `skuName` of the secondary database may be inadvertently changed to match that of the primary when an incompatible combination of SKUs is detected by the provider. */ readonly creationSourceDatabaseId: pulumi.Output; /** * Specifies the ID of the elastic pool containing this database. */ readonly elasticPoolId: pulumi.Output; /** * Specifies the type of enclave to be used by the elastic pool. When `enclaveType` is not specified (e.g., the default) enclaves are not enabled on the database. Once enabled (e.g., by specifying `Default` or `VBS`) removing the `enclaveType` field from the configuration file will force the creation of a new resource. Possible values are `Default` or `VBS`. * * > **Note:** `enclaveType` is currently not supported for DW (e.g, DataWarehouse) and DC-series SKUs. * * > **Note:** Geo Replicated and Failover databases must have the same `enclaveType`. * * > **Note:** The default value for the `enclaveType` field is unset not `Default`. */ readonly enclaveType: pulumi.Output; /** * A boolean that specifies if the Geo Backup Policy is enabled. Defaults to `true`. * * > **Note:** `geoBackupEnabled` is only applicable for DataWarehouse SKUs (DW*). This setting is ignored for all other SKUs. */ readonly geoBackupEnabled: pulumi.Output; /** * An `identity` block as defined below. */ readonly identity: pulumi.Output; /** * A `import` block as documented below. Mutually exclusive with `createMode`. */ readonly import: pulumi.Output; /** * A boolean that specifies if this is a ledger database. Defaults to `false`. Changing this forces a new resource to be created. */ readonly ledgerEnabled: pulumi.Output; /** * Specifies the license type applied to this database. Possible values are `LicenseIncluded` and `BasePrice`. */ readonly licenseType: pulumi.Output; /** * A `longTermRetentionPolicy` block as defined below. */ readonly longTermRetentionPolicy: pulumi.Output; /** * The name of the Public Maintenance Configuration window to apply to the database. Valid values include `SQL_Default`, `SQL_EastUS_DB_1`, `SQL_EastUS2_DB_1`, `SQL_SoutheastAsia_DB_1`, `SQL_AustraliaEast_DB_1`, `SQL_NorthEurope_DB_1`, `SQL_SouthCentralUS_DB_1`, `SQL_WestUS2_DB_1`, `SQL_UKSouth_DB_1`, `SQL_WestEurope_DB_1`, `SQL_EastUS_DB_2`, `SQL_EastUS2_DB_2`, `SQL_WestUS2_DB_2`, `SQL_SoutheastAsia_DB_2`, `SQL_AustraliaEast_DB_2`, `SQL_NorthEurope_DB_2`, `SQL_SouthCentralUS_DB_2`, `SQL_UKSouth_DB_2`, `SQL_WestEurope_DB_2`, `SQL_AustraliaSoutheast_DB_1`, `SQL_BrazilSouth_DB_1`, `SQL_CanadaCentral_DB_1`, `SQL_CanadaEast_DB_1`, `SQL_CentralUS_DB_1`, `SQL_EastAsia_DB_1`, `SQL_FranceCentral_DB_1`, `SQL_GermanyWestCentral_DB_1`, `SQL_CentralIndia_DB_1`, `SQL_SouthIndia_DB_1`, `SQL_JapanEast_DB_1`, `SQL_JapanWest_DB_1`, `SQL_NorthCentralUS_DB_1`, `SQL_UKWest_DB_1`, `SQL_WestUS_DB_1`, `SQL_AustraliaSoutheast_DB_2`, `SQL_BrazilSouth_DB_2`, `SQL_CanadaCentral_DB_2`, `SQL_CanadaEast_DB_2`, `SQL_CentralUS_DB_2`, `SQL_EastAsia_DB_2`, `SQL_FranceCentral_DB_2`, `SQL_GermanyWestCentral_DB_2`, `SQL_CentralIndia_DB_2`, `SQL_SouthIndia_DB_2`, `SQL_JapanEast_DB_2`, `SQL_JapanWest_DB_2`, `SQL_NorthCentralUS_DB_2`, `SQL_UKWest_DB_2`, `SQL_WestUS_DB_2`, `SQL_WestCentralUS_DB_1`, `SQL_FranceSouth_DB_1`, `SQL_WestCentralUS_DB_2`, `SQL_FranceSouth_DB_2`, `SQL_SwitzerlandNorth_DB_1`, `SQL_SwitzerlandNorth_DB_2`, `SQL_BrazilSoutheast_DB_1`, `SQL_UAENorth_DB_1`, `SQL_BrazilSoutheast_DB_2`, `SQL_UAENorth_DB_2`, `SQL_SouthAfricaNorth_DB_1`, `SQL_SouthAfricaNorth_DB_2`, `SQL_WestUS3_DB_1`, `SQL_WestUS3_DB_2`, `SQL_SwedenCentral_DB_1`, `SQL_SwedenCentral_DB_2`. Defaults to `SQL_Default`. * * > **Note:** `maintenanceConfigurationName` is only applicable if `elasticPoolId` is not set. */ readonly maintenanceConfigurationName: pulumi.Output; /** * The max size of the database in gigabytes. * * > **Note:** This value should not be configured when the `createMode` is `Secondary` or `OnlineSecondary`, as the sizing of the primary is then used as per [Azure documentation](https://docs.microsoft.com/azure/azure-sql/database/single-database-scale#geo-replicated-database). The value of `maxSizeGb` accepts `0.1`, `0.5` and positive integers greater than or equal to 1. `0.1` means `100MB`, and `0.5` means `500MB`. */ readonly maxSizeGb: pulumi.Output; /** * Minimal capacity that database will always have allocated, if not paused. This property is only settable for Serverless databases. */ readonly minCapacity: pulumi.Output; /** * The name of the MS SQL Database. Changing this forces a new resource to be created. */ readonly name: pulumi.Output; /** * The number of readonly secondary replicas associated with the database to which readonly application intent connections may be routed. This property is only settable for Hyperscale edition databases. */ readonly readReplicaCount: pulumi.Output; /** * If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica. This property is only settable for Premium and Business Critical databases. */ readonly readScale: pulumi.Output; /** * The ID of the database to be recovered. This property is only applicable when the `createMode` is `Recovery`. */ readonly recoverDatabaseId: pulumi.Output; /** * The ID of the Recovery Services Recovery Point Id to be restored. This property is only applicable when the `createMode` is `Recovery`. */ readonly recoveryPointId: pulumi.Output; /** * The ID of the database to be restored. This property is only applicable when the `createMode` is `Restore`. */ readonly restoreDroppedDatabaseId: pulumi.Output; /** * The ID of the long term retention backup to be restored. This property is only applicable when the `createMode` is `RestoreLongTermRetentionBackup`. */ readonly restoreLongTermRetentionBackupId: pulumi.Output; /** * Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. This property is only settable for `createMode`= `PointInTimeRestore` databases. */ readonly restorePointInTime: pulumi.Output; /** * Specifies the name of the sample schema to apply when creating this database. Possible value is `AdventureWorksLT`. */ readonly sampleName: pulumi.Output; /** * How do you want your replica to be made? Valid values include `Geo`, `Named` and `Standby`. Defaults to `Geo`. Changing this forces a new resource to be created. */ readonly secondaryType: pulumi.Output; /** * The id of the MS SQL Server on which to create the database. Changing this forces a new resource to be created. * * > **Note:** This setting is still required for "Serverless" SKUs */ readonly serverId: pulumi.Output; /** * A `shortTermRetentionPolicy` block as defined below. */ readonly shortTermRetentionPolicy: pulumi.Output; /** * Specifies the name of the SKU used by the database. For example, `GP_S_Gen5_2`,`HS_Gen4_1`,`BC_Gen5_2`, `ElasticPool`, `Basic`,`S0`, `P2` ,`DW100c`, `DS100`. Changing this from the HyperScale service tier to another service tier will create a new resource. * * > **Note:** A full list of supported SKU names by region can be retrieved using the Azure CLI: `az sql db list-editions -l -o table` * * > **Note:** The default `skuName` value may differ between Azure locations depending on local availability of Gen4/Gen5 capacity. When databases are replicated using the `creationSourceDatabaseId` property, the source (primary) database cannot have a higher SKU service tier than any secondary databases. When changing the `skuName` of a database having one or more secondary databases, this resource will first update any secondary databases as necessary. In such cases it's recommended to use the same `skuName` in your configuration for all related databases, as not doing so may cause an unresolvable diff during subsequent plans. */ readonly skuName: pulumi.Output; /** * Specifies the storage account type used to store backups for this database. Possible values are `Geo`, `GeoZone`, `Local` and `Zone`. Defaults to `Geo`. */ readonly storageAccountType: pulumi.Output; /** * A mapping of tags to assign to the resource. */ readonly tags: pulumi.Output<{ [key: string]: string; } | undefined>; /** * Threat detection policy configuration. The `threatDetectionPolicy` block supports fields documented below. */ readonly threatDetectionPolicy: pulumi.Output; /** * If set to true, Transparent Data Encryption will be enabled on the database. Defaults to `true`. * * > **Note:** `transparentDataEncryptionEnabled` can only be set to `false` on DW (e.g, DataWarehouse) server SKUs. */ readonly transparentDataEncryptionEnabled: pulumi.Output; /** * Boolean flag to specify whether TDE automatically rotates the encryption Key to latest version or not. Possible values are `true` or `false`. Defaults to `false`. * * > **Note:** When the `skuName` is `DW100c`, the `transparentDataEncryptionKeyAutomaticRotationEnabled` and the `transparentDataEncryptionKeyVaultKeyId` properties should not be specified, as database-level CMK is not supported for Data Warehouse SKUs. */ readonly transparentDataEncryptionKeyAutomaticRotationEnabled: pulumi.Output; /** * The fully versioned `Key Vault` `Key` URL (e.g. `'https://.vault.azure.net/keys//`) to be used as the `Customer Managed Key`(CMK/BYOK) for the `Transparent Data Encryption`(TDE) layer. * * > **Note:** To successfully deploy a `Microsoft SQL Database` in CMK/BYOK TDE the `Key Vault` must have `Soft-delete` and `purge protection` enabled to protect from data loss due to accidental key and/or key vault deletion. The `Key Vault` and the `Microsoft SQL Server` `User Managed Identity Instance` must belong to the same `Azure Active Directory` `tenant`. */ readonly transparentDataEncryptionKeyVaultKeyId: pulumi.Output; /** * Whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones. This property is only settable for Premium and Business Critical databases. */ readonly zoneRedundant: pulumi.Output; /** * Create a Database resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: DatabaseArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Database resources. */ export interface DatabaseState { /** * Time in minutes after which database is automatically paused. A value of `-1` means that automatic pause is disabled. This property is only settable for Serverless databases. */ autoPauseDelayInMinutes?: pulumi.Input; /** * Specifies the collation of the database. Changing this forces a new resource to be created. */ collation?: pulumi.Input; /** * The create mode of the database. Possible values are `Copy`, `Default`, `OnlineSecondary`, `PointInTimeRestore`, `Recovery`, `Restore`, `RestoreExternalBackup`, `RestoreExternalBackupSecondary`, `RestoreLongTermRetentionBackup` and `Secondary`. Mutually exclusive with `import`. Changing this forces a new resource to be created. Defaults to `Default`. */ createMode?: pulumi.Input; /** * The ID of the source database from which to create the new database. This should only be used for databases with `createMode` values that use another database as reference. Changing this forces a new resource to be created. * * > **Note:** When configuring a secondary database, please be aware of the constraints for the `skuName` property, as noted below, for both the primary and secondary databases. The `skuName` of the secondary database may be inadvertently changed to match that of the primary when an incompatible combination of SKUs is detected by the provider. */ creationSourceDatabaseId?: pulumi.Input; /** * Specifies the ID of the elastic pool containing this database. */ elasticPoolId?: pulumi.Input; /** * Specifies the type of enclave to be used by the elastic pool. When `enclaveType` is not specified (e.g., the default) enclaves are not enabled on the database. Once enabled (e.g., by specifying `Default` or `VBS`) removing the `enclaveType` field from the configuration file will force the creation of a new resource. Possible values are `Default` or `VBS`. * * > **Note:** `enclaveType` is currently not supported for DW (e.g, DataWarehouse) and DC-series SKUs. * * > **Note:** Geo Replicated and Failover databases must have the same `enclaveType`. * * > **Note:** The default value for the `enclaveType` field is unset not `Default`. */ enclaveType?: pulumi.Input; /** * A boolean that specifies if the Geo Backup Policy is enabled. Defaults to `true`. * * > **Note:** `geoBackupEnabled` is only applicable for DataWarehouse SKUs (DW*). This setting is ignored for all other SKUs. */ geoBackupEnabled?: pulumi.Input; /** * An `identity` block as defined below. */ identity?: pulumi.Input; /** * A `import` block as documented below. Mutually exclusive with `createMode`. */ import?: pulumi.Input; /** * A boolean that specifies if this is a ledger database. Defaults to `false`. Changing this forces a new resource to be created. */ ledgerEnabled?: pulumi.Input; /** * Specifies the license type applied to this database. Possible values are `LicenseIncluded` and `BasePrice`. */ licenseType?: pulumi.Input; /** * A `longTermRetentionPolicy` block as defined below. */ longTermRetentionPolicy?: pulumi.Input; /** * The name of the Public Maintenance Configuration window to apply to the database. Valid values include `SQL_Default`, `SQL_EastUS_DB_1`, `SQL_EastUS2_DB_1`, `SQL_SoutheastAsia_DB_1`, `SQL_AustraliaEast_DB_1`, `SQL_NorthEurope_DB_1`, `SQL_SouthCentralUS_DB_1`, `SQL_WestUS2_DB_1`, `SQL_UKSouth_DB_1`, `SQL_WestEurope_DB_1`, `SQL_EastUS_DB_2`, `SQL_EastUS2_DB_2`, `SQL_WestUS2_DB_2`, `SQL_SoutheastAsia_DB_2`, `SQL_AustraliaEast_DB_2`, `SQL_NorthEurope_DB_2`, `SQL_SouthCentralUS_DB_2`, `SQL_UKSouth_DB_2`, `SQL_WestEurope_DB_2`, `SQL_AustraliaSoutheast_DB_1`, `SQL_BrazilSouth_DB_1`, `SQL_CanadaCentral_DB_1`, `SQL_CanadaEast_DB_1`, `SQL_CentralUS_DB_1`, `SQL_EastAsia_DB_1`, `SQL_FranceCentral_DB_1`, `SQL_GermanyWestCentral_DB_1`, `SQL_CentralIndia_DB_1`, `SQL_SouthIndia_DB_1`, `SQL_JapanEast_DB_1`, `SQL_JapanWest_DB_1`, `SQL_NorthCentralUS_DB_1`, `SQL_UKWest_DB_1`, `SQL_WestUS_DB_1`, `SQL_AustraliaSoutheast_DB_2`, `SQL_BrazilSouth_DB_2`, `SQL_CanadaCentral_DB_2`, `SQL_CanadaEast_DB_2`, `SQL_CentralUS_DB_2`, `SQL_EastAsia_DB_2`, `SQL_FranceCentral_DB_2`, `SQL_GermanyWestCentral_DB_2`, `SQL_CentralIndia_DB_2`, `SQL_SouthIndia_DB_2`, `SQL_JapanEast_DB_2`, `SQL_JapanWest_DB_2`, `SQL_NorthCentralUS_DB_2`, `SQL_UKWest_DB_2`, `SQL_WestUS_DB_2`, `SQL_WestCentralUS_DB_1`, `SQL_FranceSouth_DB_1`, `SQL_WestCentralUS_DB_2`, `SQL_FranceSouth_DB_2`, `SQL_SwitzerlandNorth_DB_1`, `SQL_SwitzerlandNorth_DB_2`, `SQL_BrazilSoutheast_DB_1`, `SQL_UAENorth_DB_1`, `SQL_BrazilSoutheast_DB_2`, `SQL_UAENorth_DB_2`, `SQL_SouthAfricaNorth_DB_1`, `SQL_SouthAfricaNorth_DB_2`, `SQL_WestUS3_DB_1`, `SQL_WestUS3_DB_2`, `SQL_SwedenCentral_DB_1`, `SQL_SwedenCentral_DB_2`. Defaults to `SQL_Default`. * * > **Note:** `maintenanceConfigurationName` is only applicable if `elasticPoolId` is not set. */ maintenanceConfigurationName?: pulumi.Input; /** * The max size of the database in gigabytes. * * > **Note:** This value should not be configured when the `createMode` is `Secondary` or `OnlineSecondary`, as the sizing of the primary is then used as per [Azure documentation](https://docs.microsoft.com/azure/azure-sql/database/single-database-scale#geo-replicated-database). The value of `maxSizeGb` accepts `0.1`, `0.5` and positive integers greater than or equal to 1. `0.1` means `100MB`, and `0.5` means `500MB`. */ maxSizeGb?: pulumi.Input; /** * Minimal capacity that database will always have allocated, if not paused. This property is only settable for Serverless databases. */ minCapacity?: pulumi.Input; /** * The name of the MS SQL Database. Changing this forces a new resource to be created. */ name?: pulumi.Input; /** * The number of readonly secondary replicas associated with the database to which readonly application intent connections may be routed. This property is only settable for Hyperscale edition databases. */ readReplicaCount?: pulumi.Input; /** * If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica. This property is only settable for Premium and Business Critical databases. */ readScale?: pulumi.Input; /** * The ID of the database to be recovered. This property is only applicable when the `createMode` is `Recovery`. */ recoverDatabaseId?: pulumi.Input; /** * The ID of the Recovery Services Recovery Point Id to be restored. This property is only applicable when the `createMode` is `Recovery`. */ recoveryPointId?: pulumi.Input; /** * The ID of the database to be restored. This property is only applicable when the `createMode` is `Restore`. */ restoreDroppedDatabaseId?: pulumi.Input; /** * The ID of the long term retention backup to be restored. This property is only applicable when the `createMode` is `RestoreLongTermRetentionBackup`. */ restoreLongTermRetentionBackupId?: pulumi.Input; /** * Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. This property is only settable for `createMode`= `PointInTimeRestore` databases. */ restorePointInTime?: pulumi.Input; /** * Specifies the name of the sample schema to apply when creating this database. Possible value is `AdventureWorksLT`. */ sampleName?: pulumi.Input; /** * How do you want your replica to be made? Valid values include `Geo`, `Named` and `Standby`. Defaults to `Geo`. Changing this forces a new resource to be created. */ secondaryType?: pulumi.Input; /** * The id of the MS SQL Server on which to create the database. Changing this forces a new resource to be created. * * > **Note:** This setting is still required for "Serverless" SKUs */ serverId?: pulumi.Input; /** * A `shortTermRetentionPolicy` block as defined below. */ shortTermRetentionPolicy?: pulumi.Input; /** * Specifies the name of the SKU used by the database. For example, `GP_S_Gen5_2`,`HS_Gen4_1`,`BC_Gen5_2`, `ElasticPool`, `Basic`,`S0`, `P2` ,`DW100c`, `DS100`. Changing this from the HyperScale service tier to another service tier will create a new resource. * * > **Note:** A full list of supported SKU names by region can be retrieved using the Azure CLI: `az sql db list-editions -l -o table` * * > **Note:** The default `skuName` value may differ between Azure locations depending on local availability of Gen4/Gen5 capacity. When databases are replicated using the `creationSourceDatabaseId` property, the source (primary) database cannot have a higher SKU service tier than any secondary databases. When changing the `skuName` of a database having one or more secondary databases, this resource will first update any secondary databases as necessary. In such cases it's recommended to use the same `skuName` in your configuration for all related databases, as not doing so may cause an unresolvable diff during subsequent plans. */ skuName?: pulumi.Input; /** * Specifies the storage account type used to store backups for this database. Possible values are `Geo`, `GeoZone`, `Local` and `Zone`. Defaults to `Geo`. */ storageAccountType?: pulumi.Input; /** * A mapping of tags to assign to the resource. */ tags?: pulumi.Input<{ [key: string]: pulumi.Input; }>; /** * Threat detection policy configuration. The `threatDetectionPolicy` block supports fields documented below. */ threatDetectionPolicy?: pulumi.Input; /** * If set to true, Transparent Data Encryption will be enabled on the database. Defaults to `true`. * * > **Note:** `transparentDataEncryptionEnabled` can only be set to `false` on DW (e.g, DataWarehouse) server SKUs. */ transparentDataEncryptionEnabled?: pulumi.Input; /** * Boolean flag to specify whether TDE automatically rotates the encryption Key to latest version or not. Possible values are `true` or `false`. Defaults to `false`. * * > **Note:** When the `skuName` is `DW100c`, the `transparentDataEncryptionKeyAutomaticRotationEnabled` and the `transparentDataEncryptionKeyVaultKeyId` properties should not be specified, as database-level CMK is not supported for Data Warehouse SKUs. */ transparentDataEncryptionKeyAutomaticRotationEnabled?: pulumi.Input; /** * The fully versioned `Key Vault` `Key` URL (e.g. `'https://.vault.azure.net/keys//`) to be used as the `Customer Managed Key`(CMK/BYOK) for the `Transparent Data Encryption`(TDE) layer. * * > **Note:** To successfully deploy a `Microsoft SQL Database` in CMK/BYOK TDE the `Key Vault` must have `Soft-delete` and `purge protection` enabled to protect from data loss due to accidental key and/or key vault deletion. The `Key Vault` and the `Microsoft SQL Server` `User Managed Identity Instance` must belong to the same `Azure Active Directory` `tenant`. */ transparentDataEncryptionKeyVaultKeyId?: pulumi.Input; /** * Whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones. This property is only settable for Premium and Business Critical databases. */ zoneRedundant?: pulumi.Input; } /** * The set of arguments for constructing a Database resource. */ export interface DatabaseArgs { /** * Time in minutes after which database is automatically paused. A value of `-1` means that automatic pause is disabled. This property is only settable for Serverless databases. */ autoPauseDelayInMinutes?: pulumi.Input; /** * Specifies the collation of the database. Changing this forces a new resource to be created. */ collation?: pulumi.Input; /** * The create mode of the database. Possible values are `Copy`, `Default`, `OnlineSecondary`, `PointInTimeRestore`, `Recovery`, `Restore`, `RestoreExternalBackup`, `RestoreExternalBackupSecondary`, `RestoreLongTermRetentionBackup` and `Secondary`. Mutually exclusive with `import`. Changing this forces a new resource to be created. Defaults to `Default`. */ createMode?: pulumi.Input; /** * The ID of the source database from which to create the new database. This should only be used for databases with `createMode` values that use another database as reference. Changing this forces a new resource to be created. * * > **Note:** When configuring a secondary database, please be aware of the constraints for the `skuName` property, as noted below, for both the primary and secondary databases. The `skuName` of the secondary database may be inadvertently changed to match that of the primary when an incompatible combination of SKUs is detected by the provider. */ creationSourceDatabaseId?: pulumi.Input; /** * Specifies the ID of the elastic pool containing this database. */ elasticPoolId?: pulumi.Input; /** * Specifies the type of enclave to be used by the elastic pool. When `enclaveType` is not specified (e.g., the default) enclaves are not enabled on the database. Once enabled (e.g., by specifying `Default` or `VBS`) removing the `enclaveType` field from the configuration file will force the creation of a new resource. Possible values are `Default` or `VBS`. * * > **Note:** `enclaveType` is currently not supported for DW (e.g, DataWarehouse) and DC-series SKUs. * * > **Note:** Geo Replicated and Failover databases must have the same `enclaveType`. * * > **Note:** The default value for the `enclaveType` field is unset not `Default`. */ enclaveType?: pulumi.Input; /** * A boolean that specifies if the Geo Backup Policy is enabled. Defaults to `true`. * * > **Note:** `geoBackupEnabled` is only applicable for DataWarehouse SKUs (DW*). This setting is ignored for all other SKUs. */ geoBackupEnabled?: pulumi.Input; /** * An `identity` block as defined below. */ identity?: pulumi.Input; /** * A `import` block as documented below. Mutually exclusive with `createMode`. */ import?: pulumi.Input; /** * A boolean that specifies if this is a ledger database. Defaults to `false`. Changing this forces a new resource to be created. */ ledgerEnabled?: pulumi.Input; /** * Specifies the license type applied to this database. Possible values are `LicenseIncluded` and `BasePrice`. */ licenseType?: pulumi.Input; /** * A `longTermRetentionPolicy` block as defined below. */ longTermRetentionPolicy?: pulumi.Input; /** * The name of the Public Maintenance Configuration window to apply to the database. Valid values include `SQL_Default`, `SQL_EastUS_DB_1`, `SQL_EastUS2_DB_1`, `SQL_SoutheastAsia_DB_1`, `SQL_AustraliaEast_DB_1`, `SQL_NorthEurope_DB_1`, `SQL_SouthCentralUS_DB_1`, `SQL_WestUS2_DB_1`, `SQL_UKSouth_DB_1`, `SQL_WestEurope_DB_1`, `SQL_EastUS_DB_2`, `SQL_EastUS2_DB_2`, `SQL_WestUS2_DB_2`, `SQL_SoutheastAsia_DB_2`, `SQL_AustraliaEast_DB_2`, `SQL_NorthEurope_DB_2`, `SQL_SouthCentralUS_DB_2`, `SQL_UKSouth_DB_2`, `SQL_WestEurope_DB_2`, `SQL_AustraliaSoutheast_DB_1`, `SQL_BrazilSouth_DB_1`, `SQL_CanadaCentral_DB_1`, `SQL_CanadaEast_DB_1`, `SQL_CentralUS_DB_1`, `SQL_EastAsia_DB_1`, `SQL_FranceCentral_DB_1`, `SQL_GermanyWestCentral_DB_1`, `SQL_CentralIndia_DB_1`, `SQL_SouthIndia_DB_1`, `SQL_JapanEast_DB_1`, `SQL_JapanWest_DB_1`, `SQL_NorthCentralUS_DB_1`, `SQL_UKWest_DB_1`, `SQL_WestUS_DB_1`, `SQL_AustraliaSoutheast_DB_2`, `SQL_BrazilSouth_DB_2`, `SQL_CanadaCentral_DB_2`, `SQL_CanadaEast_DB_2`, `SQL_CentralUS_DB_2`, `SQL_EastAsia_DB_2`, `SQL_FranceCentral_DB_2`, `SQL_GermanyWestCentral_DB_2`, `SQL_CentralIndia_DB_2`, `SQL_SouthIndia_DB_2`, `SQL_JapanEast_DB_2`, `SQL_JapanWest_DB_2`, `SQL_NorthCentralUS_DB_2`, `SQL_UKWest_DB_2`, `SQL_WestUS_DB_2`, `SQL_WestCentralUS_DB_1`, `SQL_FranceSouth_DB_1`, `SQL_WestCentralUS_DB_2`, `SQL_FranceSouth_DB_2`, `SQL_SwitzerlandNorth_DB_1`, `SQL_SwitzerlandNorth_DB_2`, `SQL_BrazilSoutheast_DB_1`, `SQL_UAENorth_DB_1`, `SQL_BrazilSoutheast_DB_2`, `SQL_UAENorth_DB_2`, `SQL_SouthAfricaNorth_DB_1`, `SQL_SouthAfricaNorth_DB_2`, `SQL_WestUS3_DB_1`, `SQL_WestUS3_DB_2`, `SQL_SwedenCentral_DB_1`, `SQL_SwedenCentral_DB_2`. Defaults to `SQL_Default`. * * > **Note:** `maintenanceConfigurationName` is only applicable if `elasticPoolId` is not set. */ maintenanceConfigurationName?: pulumi.Input; /** * The max size of the database in gigabytes. * * > **Note:** This value should not be configured when the `createMode` is `Secondary` or `OnlineSecondary`, as the sizing of the primary is then used as per [Azure documentation](https://docs.microsoft.com/azure/azure-sql/database/single-database-scale#geo-replicated-database). The value of `maxSizeGb` accepts `0.1`, `0.5` and positive integers greater than or equal to 1. `0.1` means `100MB`, and `0.5` means `500MB`. */ maxSizeGb?: pulumi.Input; /** * Minimal capacity that database will always have allocated, if not paused. This property is only settable for Serverless databases. */ minCapacity?: pulumi.Input; /** * The name of the MS SQL Database. Changing this forces a new resource to be created. */ name?: pulumi.Input; /** * The number of readonly secondary replicas associated with the database to which readonly application intent connections may be routed. This property is only settable for Hyperscale edition databases. */ readReplicaCount?: pulumi.Input; /** * If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica. This property is only settable for Premium and Business Critical databases. */ readScale?: pulumi.Input; /** * The ID of the database to be recovered. This property is only applicable when the `createMode` is `Recovery`. */ recoverDatabaseId?: pulumi.Input; /** * The ID of the Recovery Services Recovery Point Id to be restored. This property is only applicable when the `createMode` is `Recovery`. */ recoveryPointId?: pulumi.Input; /** * The ID of the database to be restored. This property is only applicable when the `createMode` is `Restore`. */ restoreDroppedDatabaseId?: pulumi.Input; /** * The ID of the long term retention backup to be restored. This property is only applicable when the `createMode` is `RestoreLongTermRetentionBackup`. */ restoreLongTermRetentionBackupId?: pulumi.Input; /** * Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. This property is only settable for `createMode`= `PointInTimeRestore` databases. */ restorePointInTime?: pulumi.Input; /** * Specifies the name of the sample schema to apply when creating this database. Possible value is `AdventureWorksLT`. */ sampleName?: pulumi.Input; /** * How do you want your replica to be made? Valid values include `Geo`, `Named` and `Standby`. Defaults to `Geo`. Changing this forces a new resource to be created. */ secondaryType?: pulumi.Input; /** * The id of the MS SQL Server on which to create the database. Changing this forces a new resource to be created. * * > **Note:** This setting is still required for "Serverless" SKUs */ serverId: pulumi.Input; /** * A `shortTermRetentionPolicy` block as defined below. */ shortTermRetentionPolicy?: pulumi.Input; /** * Specifies the name of the SKU used by the database. For example, `GP_S_Gen5_2`,`HS_Gen4_1`,`BC_Gen5_2`, `ElasticPool`, `Basic`,`S0`, `P2` ,`DW100c`, `DS100`. Changing this from the HyperScale service tier to another service tier will create a new resource. * * > **Note:** A full list of supported SKU names by region can be retrieved using the Azure CLI: `az sql db list-editions -l -o table` * * > **Note:** The default `skuName` value may differ between Azure locations depending on local availability of Gen4/Gen5 capacity. When databases are replicated using the `creationSourceDatabaseId` property, the source (primary) database cannot have a higher SKU service tier than any secondary databases. When changing the `skuName` of a database having one or more secondary databases, this resource will first update any secondary databases as necessary. In such cases it's recommended to use the same `skuName` in your configuration for all related databases, as not doing so may cause an unresolvable diff during subsequent plans. */ skuName?: pulumi.Input; /** * Specifies the storage account type used to store backups for this database. Possible values are `Geo`, `GeoZone`, `Local` and `Zone`. Defaults to `Geo`. */ storageAccountType?: pulumi.Input; /** * A mapping of tags to assign to the resource. */ tags?: pulumi.Input<{ [key: string]: pulumi.Input; }>; /** * Threat detection policy configuration. The `threatDetectionPolicy` block supports fields documented below. */ threatDetectionPolicy?: pulumi.Input; /** * If set to true, Transparent Data Encryption will be enabled on the database. Defaults to `true`. * * > **Note:** `transparentDataEncryptionEnabled` can only be set to `false` on DW (e.g, DataWarehouse) server SKUs. */ transparentDataEncryptionEnabled?: pulumi.Input; /** * Boolean flag to specify whether TDE automatically rotates the encryption Key to latest version or not. Possible values are `true` or `false`. Defaults to `false`. * * > **Note:** When the `skuName` is `DW100c`, the `transparentDataEncryptionKeyAutomaticRotationEnabled` and the `transparentDataEncryptionKeyVaultKeyId` properties should not be specified, as database-level CMK is not supported for Data Warehouse SKUs. */ transparentDataEncryptionKeyAutomaticRotationEnabled?: pulumi.Input; /** * The fully versioned `Key Vault` `Key` URL (e.g. `'https://.vault.azure.net/keys//`) to be used as the `Customer Managed Key`(CMK/BYOK) for the `Transparent Data Encryption`(TDE) layer. * * > **Note:** To successfully deploy a `Microsoft SQL Database` in CMK/BYOK TDE the `Key Vault` must have `Soft-delete` and `purge protection` enabled to protect from data loss due to accidental key and/or key vault deletion. The `Key Vault` and the `Microsoft SQL Server` `User Managed Identity Instance` must belong to the same `Azure Active Directory` `tenant`. */ transparentDataEncryptionKeyVaultKeyId?: pulumi.Input; /** * Whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones. This property is only settable for Premium and Business Critical databases. */ zoneRedundant?: pulumi.Input; }