subcategory | layout | page_title | description |
---|---|---|---|
Database |
azurerm |
Azure Resource Manager: azurerm_mssql_elasticpool |
Manages a SQL Elastic Pool. |
Allows you to manage an Azure SQL Elastic Pool via the v3.0
API which allows for vCore
and DTU
based configurations.
resource "azurerm_resource_group" "example" {
name = "my-resource-group"
location = "westeurope"
}
resource "azurerm_sql_server" "example" {
name = "my-sql-server"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
version = "12.0"
administrator_login = "4dm1n157r470r"
administrator_login_password = "4-v3ry-53cr37-p455w0rd"
}
resource "azurerm_mssql_elasticpool" "example" {
name = "test-epool"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
server_name = azurerm_sql_server.example.name
license_type = "LicenseIncluded"
max_size_gb = 756
sku {
name = "GP_Gen5"
tier = "GeneralPurpose"
family = "Gen5"
capacity = 4
}
per_database_settings {
min_capacity = 0.25
max_capacity = 4
}
}
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
. -
license_type
- (Optional) Specifies the license type applied to this database. Possible values areLicenseIncluded
andBasePrice
.
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.
The following attributes are exported:
id
- The ID of the MS SQL Elastic Pool.
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.
SQL Elastic Pool can be imported using the resource id
, e.g.
terraform import azurerm_mssql_elasticpool.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/providers/Microsoft.Sql/servers/myserver/elasticPools/myelasticpoolname