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
provider/azurerm: Add resource azurerm_sql_elasticpool #14099
provider/azurerm: Add resource azurerm_sql_elasticpool #14099
Conversation
Fixes: hashicorp#12673 Unfortunately, this ElasticPool has to actually be created so we need to implement the ElasticPool resource
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR :)
I've reviewed and left some comments inline, but it otherwise looks good to me :)
Tests Pass:
$ envchain azurerm make testacc TEST=./builtin/providers/azurerm TESTARGS='-run=TestAccAzureRMSqlElasticPool'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/05/02 08:40:45 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/azurerm -v -run=TestAccAzureRMSqlElasticPool -timeout 120m
=== RUN TestAccAzureRMSqlElasticPool_importBasic
--- PASS: TestAccAzureRMSqlElasticPool_importBasic (132.54s)
=== RUN TestAccAzureRMSqlElasticPool_basic
--- PASS: TestAccAzureRMSqlElasticPool_basic (144.69s)
=== RUN TestAccAzureRMSqlElasticPool_resizeDtu
--- PASS: TestAccAzureRMSqlElasticPool_resizeDtu (257.79s)
PASS
ok github.com/hashicorp/terraform/builtin/providers/azurerm 535.042s
Thanks!
builtin/providers/azurerm/config.go
Outdated
@@ -99,6 +100,11 @@ type ArmClient struct { | |||
serviceBusSubscriptionsClient servicebus.SubscriptionsClient | |||
|
|||
keyVaultClient keyvault.VaultsClient | |||
|
|||
sqlDatabasesClient sql.DatabasesClient |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given we're currently using the Riviera SDK for this functionality, this client isn't used. As such - is it possible to remove it for the moment?
builtin/providers/azurerm/config.go
Outdated
|
||
sqlDatabasesClient sql.DatabasesClient | ||
sqlElasticPoolsClient sql.ElasticPoolsClient | ||
sqlRecommendedElasticPoolsClient sql.RecommendedElasticPoolsClient |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given we're currently using the Riviera SDK for this functionality, this client isn't used. As such - is it possible to remove it for the moment?
builtin/providers/azurerm/config.go
Outdated
sqlDatabasesClient sql.DatabasesClient | ||
sqlElasticPoolsClient sql.ElasticPoolsClient | ||
sqlRecommendedElasticPoolsClient sql.RecommendedElasticPoolsClient | ||
sqlServersClient sql.ServersClient |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given we're currently using the Riviera SDK for this functionality, this client isn't used. As such - is it possible to remove it for the moment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have removed the unused clients except for sqlElasticPoolsClient
which is used by the resource. I assume, Terraform has deprecated the Riviera SDK and will prefer the Azure RM Go SDK, right?
d.Set("server_name", serverName) | ||
d.Set("edition", string(elasticPool.Edition)) | ||
d.Set("dtu", int(*elasticPool.Dtu)) | ||
d.Set("db_dtu_min", int(*elasticPool.DatabaseDtuMin)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it worth checking that resp.ElasticPoolProperties
isn't nil
before assigning these, to prevent a possible crash?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Safe guard is now included.
…eature/azurerm-sql-elasticpool
… to verify creating a SQL database in an SQL elastic pool
…o SDK clients; Safe guard ElasticPoolProperties in resourceArmSqlElasticPoolRead
Thanks for the feedback @tombuildsstuff. With the recent commits, I addressed your comments. In addition, I have included the changes proposed in #12678 in this pull request to allow managing databases in elastic pools. Also, the test
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pushing those fixes and integrating #12678
I've taken another look and pushed a small fix for a typo in the documentation - but this is looking great :)
Thanks for this contribution - it's great to see this merged :)
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
This pull request adds the resource
azurerm_sql_elasticpool
to create and manage Azure SQL Elastic Pools.Notes:
azurerm_sql_elasticpool
uses theazure-sdk-for-go
. For this purpose, I have added it to the vendor dependencies.Related issues and pull requests:
Acceptance tests:
Tasks:
azurerm_sql_elasticpool
TestAccAzureRMSqlElasticPool_basic
(verifies creating a SQL Elasticpool)TestAccAzureRMSqlElasticPool_resizeDtu
(verifies resizing the DTU limit of a SQL Elasticpool)TestAccAzureRMSqlElasticPool_importBasic
(verifies a SQL Elasticpool can be imported)