Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Including set max_size_bytes #2346

Merged
merged 11 commits into from
Jan 12, 2019
15 changes: 8 additions & 7 deletions azurerm/resource_arm_mssql_elasticpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,10 @@ func resourceArmMsSqlElasticPool() *schema.Resource {
},

"max_size_bytes": {
katbyte marked this conversation as resolved.
Show resolved Hide resolved
Type: schema.TypeInt,
Computed: true,
Type: schema.TypeInt,
Optional: true,
Computed: true,
ValidateFunc: validation.IntAtLeast(0),
},

"zone_redundant": {
Expand Down Expand Up @@ -277,6 +279,10 @@ func resourceArmMsSqlElasticPoolCreateUpdate(d *schema.ResourceData, meta interf
},
}

if v, ok := d.GetOk("max_size_bytes"); ok {
elasticPool.MaxSizeBytes = utils.Int64(int64(v.(int)))
}

future, err := client.CreateOrUpdate(ctx, resGroup, serverName, elasticPoolName, elasticPool)
if err != nil {
return err
Expand Down Expand Up @@ -425,11 +431,6 @@ func flattenAzureRmMsSqlElasticPoolSku(resp *sql.Sku) []interface{} {

func flattenAzureRmMsSqlElasticPoolProperties(resp *sql.ElasticPoolProperties) []interface{} {
elasticPoolProperty := map[string]interface{}{}

if maxSizeBytes := resp.MaxSizeBytes; maxSizeBytes != nil {
elasticPoolProperty["max_size_bytes"] = *maxSizeBytes
}

elasticPoolProperty["state"] = string(resp.State)

if date := resp.CreationDate; date != nil {
Expand Down
14 changes: 8 additions & 6 deletions azurerm/resource_arm_mssql_elasticpool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func TestAccAzureRMMsSqlElasticPool_basic_DTU(t *testing.T) {
ri := acctest.RandInt()
config := testAccAzureRMMsSqlElasticPool_basic_DTU(ri, testLocation())

resource.Test(t, resource.TestCase{
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMMsSqlElasticPoolDestroy,
Expand Down Expand Up @@ -47,7 +47,7 @@ func TestAccAzureRMMsSqlElasticPool_basic_vCore(t *testing.T) {
ri := acctest.RandInt()
config := testAccAzureRMMsSqlElasticPool_basic_vCore(ri, testLocation())

resource.Test(t, resource.TestCase{
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMMsSqlElasticPoolDestroy,
Expand Down Expand Up @@ -80,7 +80,7 @@ func TestAccAzureRMMsSqlElasticPool_disappears(t *testing.T) {
ri := acctest.RandInt()
config := testAccAzureRMMsSqlElasticPool_basic_DTU(ri, testLocation())

resource.Test(t, resource.TestCase{
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMMsSqlElasticPoolDestroy,
Expand Down Expand Up @@ -109,7 +109,7 @@ func TestAccAzureRMMsSqlElasticPool_resize_DTU(t *testing.T) {
preConfig := testAccAzureRMMsSqlElasticPool_basic_DTU(ri, location)
postConfig := testAccAzureRMMsSqlElasticPool_resize_DTU(ri, location)

resource.Test(t, resource.TestCase{
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMMsSqlElasticPoolDestroy,
Expand Down Expand Up @@ -147,7 +147,7 @@ func TestAccAzureRMMsSqlElasticPool_resize_vCore(t *testing.T) {
preConfig := testAccAzureRMMsSqlElasticPool_basic_vCore(ri, location)
postConfig := testAccAzureRMMsSqlElasticPool_resize_vCore(ri, location)

resource.Test(t, resource.TestCase{
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMMsSqlElasticPoolDestroy,
Expand Down Expand Up @@ -293,6 +293,7 @@ resource "azurerm_mssql_elasticpool" "test" {
resource_group_name = "${azurerm_resource_group.test.name}"
location = "${azurerm_resource_group.test.location}"
server_name = "${azurerm_sql_server.test.name}"
max_size_bytes = 5368709120

sku {
name = "%[3]s"
Expand Down Expand Up @@ -330,7 +331,8 @@ resource "azurerm_mssql_elasticpool" "test" {
resource_group_name = "${azurerm_resource_group.test.name}"
location = "${azurerm_resource_group.test.location}"
server_name = "${azurerm_sql_server.test.name}"

max_size_bytes = 5368709120

sku {
name = "%[3]s"
tier = "%[4]s"
Expand Down
5 changes: 3 additions & 2 deletions website/docs/r/mssql_elasticpool.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ resource "azurerm_mssql_elasticpool" "test" {
resource_group_name = "${azurerm_resource_group.test.name}"
location = "${azurerm_resource_group.test.location}"
server_name = "${azurerm_sql_server.test.name}"
max_size_bytes = 5368709120

sku {
name = "GP_Gen5"
Expand Down Expand Up @@ -63,6 +64,8 @@ The following arguments are supported:

* `per_database_settings` - (Required) A `per_database_settings` block as defined below.

* `max_size_bytes` - (Optional) The max data size of the elastic pool in bytes.

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

---
Expand Down Expand Up @@ -93,8 +96,6 @@ The following attributes are exported:

* `id` - The MsSQL Elastic Pool ID.

* `max_size_bytes` - The storage limit for the database elastic pool in bytes.

* `zone_redundant` - Whether or not this elastic pool is zone redundant.

## Import
Expand Down