» azurerm_mssql_elasticpool
Allows you to manage an Azure SQL Elastic Pool via the 2017-10-01-preview
API which allows for vCore
and DTU
based configurations.
» Example Usage
resource "azurerm_resource_group" "test" {
name = "my-resource-group"
location = "westeurope"
}
resource "azurerm_sql_server" "test" {
name = "my-sql-server"
resource_group_name = "${azurerm_resource_group.test.name}"
location = "${azurerm_resource_group.test.location}"
version = "12.0"
administrator_login = "4dm1n157r470r"
administrator_login_password = "4-v3ry-53cr37-p455w0rd"
}
resource "azurerm_mssql_elasticpool" "test" {
name = "test-epool"
resource_group_name = "${azurerm_resource_group.test.name}"
location = "${azurerm_resource_group.test.location}"
server_name = "${azurerm_sql_server.test.name}"
max_size_gb = 756
sku {
name = "GP_Gen5"
tier = "GeneralPurpose"
family = "Gen5"
capacity = 4
}
per_database_settings {
min_capacity = 0.25
max_capacity = 4
}
}
» 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. -
resource_group_name
- (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. -
location
- (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. -
server_name
- (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. -
per_database_settings
- (Required) Aper_database_settings
block as defined below. -
max_size_gb
- (Optional) The max data size of the elastic pool in gigabytes. Conflicts withmax_size_bytes
. -
max_size_bytes
- (Optional) The max data size of the elastic pool in bytes. Conflicts withmax_size_gb
. -
tags
- (Optional) A mapping of tags to assign to the resource. -
zone_redundant
- (Optional) Whether or not this elastic pool is zone redundant.tier
needs to bePremium
forDTU
based orBusinessCritical
forvCore
basedsku
. Defaults tofalse
.
sku
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. -
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
orGen5
.
per_database_settings
supports the following:
-
min_capacity
- (Required) The minimum capacity all databases are guaranteed. -
max_capacity
- (Required) The maximum capacity any one database can consume.
» Attributes Reference
The following attributes are exported:
-
id
- The MsSQL Elastic Pool ID.
» Import
SQL Elastic Pool can be imported using the resource id
, e.g.
terraform import azurerm_mssql_elasticpool.test /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/providers/Microsoft.Sql/servers/myserver/elasticPools/myelasticpoolname