Merge commit 'a5908cd288d5ab3754d47376ce162369e569bba2' into public-feature/azurerm-sql-elasticpool

This commit is contained in:
Dominik Lekse 2017-05-02 14:27:28 +02:00
commit f41594952e
2 changed files with 52 additions and 0 deletions

View File

@ -158,6 +158,10 @@ func resourceArmSqlDatabaseCreate(d *schema.ResourceData, meta interface{}) erro
command.RequestedServiceObjectiveID = azure.String(v.(string))
}
if v, ok := d.GetOk("elastic_pool_name"); ok {
command.ElasticPoolName = azure.String(v.(string))
}
if v, ok := d.GetOk("requested_service_objective_name"); ok {
command.RequestedServiceObjectiveName = azure.String(v.(string))
}
@ -216,6 +220,7 @@ func resourceArmSqlDatabaseRead(d *schema.ResourceData, meta interface{}) error
d.Set("name", resp.Name)
d.Set("creation_date", resp.CreationDate)
d.Set("default_secondary_location", resp.DefaultSecondaryLocation)
d.Set("elastic_pool_name", resp.ElasticPoolName)
flattenAndSetTags(d, resp.Tags)

View File

@ -65,6 +65,26 @@ func TestAccAzureRMSqlDatabase_basic(t *testing.T) {
})
}
func TestAccAzureRMSqlDatabase_elasticPool(t *testing.T) {
ri := acctest.RandInt()
config := fmt.Sprintf(testAccAzureRMSqlDatabase_elasticPool, ri, ri, ri)
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMSqlDatabaseDestroy,
Steps: []resource.TestStep{
{
Config: config,
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMSqlDatabaseExists("azurerm_sql_database.test"),
resource.TestCheckResourceAttr("azurerm_sql_database.test", "elastic_pool_name", "test_ep"),
),
},
},
})
}
func TestAccAzureRMSqlDatabase_withTags(t *testing.T) {
ri := acctest.RandInt()
preConfig := fmt.Sprintf(testAccAzureRMSqlDatabase_withTags, ri, ri, ri)
@ -163,6 +183,33 @@ func testCheckAzureRMSqlDatabaseDestroy(s *terraform.State) error {
return nil
}
var testAccAzureRMSqlDatabase_elasticPool = `
resource "azurerm_resource_group" "test" {
name = "acctestRG_%d"
location = "West US"
}
resource "azurerm_sql_server" "test" {
name = "acctestsqlserver%d"
resource_group_name = "${azurerm_resource_group.test.name}"
location = "West US"
version = "12.0"
administrator_login = "mradministrator"
administrator_login_password = "thisIsDog11"
}
resource "azurerm_sql_database" "test" {
name = "acctestdb%d"
resource_group_name = "${azurerm_resource_group.test.name}"
server_name = "${azurerm_sql_server.test.name}"
location = "West US"
edition = "Standard"
collation = "SQL_Latin1_General_CP1_CI_AS"
max_size_bytes = "1073741824"
elastic_pool_name = "test_ep"
requested_service_objective_name = "ElasticPool"
}
`
var testAccAzureRMSqlDatabase_basic = `
resource "azurerm_resource_group" "test" {
name = "acctestRG_%d"