azurermMssqlElasticpool
Allows you to manage an Azure SQL Elastic Pool via the v30
API which allows for vCore
and dtu
based configurations.
Example Usage
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
this,
"example",
{
location: "West Europe",
name: "my-resource-group",
}
);
const azurermSqlServerExample = new azurerm.sqlServer.SqlServer(
this,
"example_1",
{
administrator_login: "4dm1n157r470r",
administrator_login_password: "4-v3ry-53cr37-p455w0rd",
location: azurermResourceGroupExample.location,
name: "my-sql-server",
resource_group_name: azurermResourceGroupExample.name,
version: "12.0",
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermSqlServerExample.overrideLogicalId("example");
const azurermMssqlElasticpoolExample =
new azurerm.mssqlElasticpool.MssqlElasticpool(this, "example_2", {
license_type: "LicenseIncluded",
location: azurermResourceGroupExample.location,
max_size_gb: 756,
name: "test-epool",
per_database_settings: [
{
max_capacity: 4,
min_capacity: 0.25,
},
],
resource_group_name: azurermResourceGroupExample.name,
server_name: azurermSqlServerExample.name,
sku: [
{
capacity: 4,
family: "Gen4",
name: "BasicPool",
tier: "Basic",
},
],
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermMssqlElasticpoolExample.overrideLogicalId("example");
Argument Reference
The following arguments are supported:
-
name
- (Required) The name of the elastic pool. This needs to be globally unique. Changing this forces a new resource to be created. -
resourceGroupName
- (Required) The name of the resource group in which to create the elastic pool. This must be the same as the resource group of the underlying SQL server. Changing this forces a new resource to be created. -
location
- (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. -
serverName
- (Required) The name of the SQL Server on which to create the elastic pool. Changing this forces a new resource to be created. -
sku
- (Required) Asku
block as defined below. -
perDatabaseSettings
- (Required) AperDatabaseSettings
block as defined below. -
maintenanceConfigurationName
- (Optional) The name of the Public Maintenance Configuration window to apply to the elastic pool. Valid values includesqlDefault
,sqlEastUsDb1
,sqlEastUs2Db1
,sqlSoutheastAsiaDb1
,sqlAustraliaEastDb1
,sqlNorthEuropeDb1
,sqlSouthCentralUsDb1
,sqlWestUs2Db1
,sqlUkSouthDb1
,sqlWestEuropeDb1
,sqlEastUsDb2
,sqlEastUs2Db2
,sqlWestUs2Db2
,sqlSoutheastAsiaDb2
,sqlAustraliaEastDb2
,sqlNorthEuropeDb2
,sqlSouthCentralUsDb2
,sqlUkSouthDb2
,sqlWestEuropeDb2
,sqlAustraliaSoutheastDb1
,sqlBrazilSouthDb1
,sqlCanadaCentralDb1
,sqlCanadaEastDb1
,sqlCentralUsDb1
,sqlEastAsiaDb1
,sqlFranceCentralDb1
,sqlGermanyWestCentralDb1
,sqlCentralIndiaDb1
,sqlSouthIndiaDb1
,sqlJapanEastDb1
,sqlJapanWestDb1
,sqlNorthCentralUsDb1
,sqlUkWestDb1
,sqlWestUsDb1
,sqlAustraliaSoutheastDb2
,sqlBrazilSouthDb2
,sqlCanadaCentralDb2
,sqlCanadaEastDb2
,sqlCentralUsDb2
,sqlEastAsiaDb2
,sqlFranceCentralDb2
,sqlGermanyWestCentralDb2
,sqlCentralIndiaDb2
,sqlSouthIndiaDb2
,sqlJapanEastDb2
,sqlJapanWestDb2
,sqlNorthCentralUsDb2
,sqlUkWestDb2
,sqlWestUsDb2
,sqlWestCentralUsDb1
,sqlFranceSouthDb1
,sqlWestCentralUsDb2
,sqlFranceSouthDb2
,sqlSwitzerlandNorthDb1
,sqlSwitzerlandNorthDb2
,sqlBrazilSoutheastDb1
,sqlUaeNorthDb1
,sqlBrazilSoutheastDb2
,sqlUaeNorthDb2
. Defaults tosqlDefault
. -
maxSizeGb
- (Optional) The max data size of the elastic pool in gigabytes. Conflicts withmaxSizeBytes
. -
maxSizeBytes
- (Optional) The max data size of the elastic pool in bytes. Conflicts withmaxSizeGb
.
-> Note: One of either maxSizeGb
or maxSizeBytes
must be specified.
-
tags
- (Optional) A mapping of tags to assign to the resource. -
zoneRedundant
- (Optional) Whether or not this elastic pool is zone redundant.tier
needs to bepremium
fordtu
based orbusinessCritical
forvCore
basedsku
. -
licenseType
- (Optional) Specifies the license type applied to this database. Possible values arelicenseIncluded
andbasePrice
.
-> Note: licenseType
can only be configured when sku0Tier
is set to generalPurpose
or businessCritical
The sku
block supports the following:
-
name
- (Required) Specifies the SKU Name for this Elasticpool. The name of the SKU, will be eithervCore
basedtier
+family
pattern (e.g. GP_Gen4, BC_Gen5) or thedtu
basedbasicPool
,standardPool
, orpremiumPool
pattern. Possible values arebasicPool
,standardPool
,premiumPool
,gpGen4
,gpGen5
,gpFsv2
,gpDc
,bcGen4
,bcGen5
andbcDc
. -
capacity
- (Required) The scale up/out capacity, representing server's compute units. For more information see the documentation for your Elasticpool configuration: vCore-based or DTU-based. -
tier
- (Required) The tier of the particular SKU. Possible values aregeneralPurpose
,businessCritical
,basic
,standard
, orpremium
. For more information see the documentation for your Elasticpool configuration: vCore-based or DTU-based. -
family
- (Optional) Thefamily
of hardwaregen4
,gen5
,fsv2
ordc
.
The perDatabaseSettings
block supports the following:
-
minCapacity
- (Required) The minimum capacity all databases are guaranteed. -
maxCapacity
- (Required) The maximum capacity any one database can consume.
Attributes Reference
The following attributes are exported:
id
- The ID of the MS SQL Elastic Pool.
Timeouts
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 30 minutes) Used when creating the MS SQL Elastic Pool.update
- (Defaults to 30 minutes) Used when updating the MS SQL Elastic Pool.read
- (Defaults to 5 minutes) Used when retrieving the MS SQL Elastic Pool.delete
- (Defaults to 30 minutes) Used when deleting the MS SQL Elastic Pool.
Import
SQL Elastic Pool can be imported using the resourceId
, e.g.