Skip to content

azurermSqlElasticpool

Allows you to manage an Azure SQL Elastic Pool.

-> Note: The azurermSqlElasticpool resource is deprecated in version 3.0 of the AzureRM provider and will be removed in version 4.0. Please use the azurermMssqlElasticpool resource instead.

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 azurermSqlElasticpoolExample = new azurerm.sqlElasticpool.SqlElasticpool(
  this,
  "example_2",
  {
    db_dtu_max: 5,
    db_dtu_min: 0,
    dtu: 50,
    edition: "Basic",
    location: azurermResourceGroupExample.location,
    name: "test",
    pool_size: 5000,
    resource_group_name: azurermResourceGroupExample.name,
    server_name: azurermSqlServerExample.name,
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermSqlElasticpoolExample.overrideLogicalId("example");

\~> NOTE on azurermSqlElasticpool: - The values of edition, dtu, and poolSize must be consistent with the Azure SQL Database Service Tiers. Any inconsistent argument configuration will be rejected.

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.

  • edition - (Required) The edition of the elastic pool to be created. Valid values are basic, standard, and premium. Refer to Azure SQL Database Service Tiers for details. Changing this forces a new resource to be created.

  • dtu - (Required) The total shared DTU for the elastic pool. Valid values depend on the edition which has been defined. Refer to Azure SQL Database Service Tiers for valid combinations.

  • dbDtuMin - (Optional) The minimum DTU which will be guaranteed to all databases in the elastic pool to be created.

  • dbDtuMax - (Optional) The maximum DTU which will be guaranteed to all databases in the elastic pool to be created.

  • poolSize - (Optional) The maximum size in MB that all databases in the elastic pool can grow to. The maximum size must be consistent with combination of edition and dtu and the limits documented in Azure SQL Database Service Tiers. If not defined when creating an elastic pool, the value is set to the size implied by edition and dtu.

  • tags - (Optional) A mapping of tags to assign to the resource.

Attributes Reference

The following attributes are exported:

  • id - The SQL Elastic Pool ID.

  • creationDate - The creation date of the SQL Elastic Pool.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 30 minutes) Used when creating the SQL Elastic Pool.
  • update - (Defaults to 30 minutes) Used when updating the SQL Elastic Pool.
  • read - (Defaults to 5 minutes) Used when retrieving the SQL Elastic Pool.
  • delete - (Defaults to 30 minutes) Used when deleting the SQL Elastic Pool.

Import

SQL Elastic Pool's can be imported using the resourceId, e.g.

terraform import azurerm_sql_elasticpool.pool1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/providers/Microsoft.Sql/servers/myserver/elasticPools/pool1