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

azurerm_sql_elasticpool Example Usage code fails #93

Closed
hashibot opened this issue Jun 13, 2017 · 4 comments · Fixed by #289
Closed

azurerm_sql_elasticpool Example Usage code fails #93

hashibot opened this issue Jun 13, 2017 · 4 comments · Fixed by #289
Assignees

Comments

@hashibot
Copy link

This issue was originally opened by @holmesb as hashicorp/terraform#14785. It was migrated here as part of the provider split. The original body of the issue is below.


Terraform Version

v0.9.5

Affected Resource(s)

azurerm_sql_elasticpool

Terraform Configuration Files

Example Usage code:

  name = "test"
  location = "West US"
}

resource "azurerm_sql_server" "test" {
    name = "test"
    resource_group_name = "${azurerm_resource_group.test.name}"
    location = "West US"
    version = "12.0"
    administrator_login = "4dm1n157r470r"
    administrator_login_password = "4-v3ry-53cr37-p455w0rd"
}

resource "azurerm_sql_elasticpool" "test" {
    name = "test"
    resource_group_name = "${azurerm_resource_group.test.name}"
    location = "West US"
    server_name = "${azurerm_sql_server.test.name}"
    edition = "Basic"
    dtu = 100
    db_min_dtu = 0
    db_max_dtu = 5
    pool_size = 5000
}

Expected Behavior

SQL Elastic pool is created

Actual Behavior

Running Example Usage code gives:
"invalid or unknown key: db_max_dtu"
"invalid or unknown key: db_min_dtu"

After removing these two attributes, get

Error applying plan:

1 error(s) occurred:

* azurerm_sql_server.test: 1 error(s) occurred:

* azurerm_sql_server.test: Error creating SQL Server: PUT https://management.azure.com/subscriptions/4689b617-acad-40dc-a40f-77a442339589/resourceGroups/test_resource_group/providers/Microsoft.Sql/servers/test?api-version=2014-04-01-preview giving up after 5 attempts

Terraform does not automatically rollback in the face of errors...

And then on second attempt:

Error applying plan:

1 error(s) occurred:

* azurerm_sql_server.test: 1 error(s) occurred:

* azurerm_sql_server.test: Error creating SQL Server: 40647 (404) - Subscription '4689b617-acad-40dc-a40f-77a442339589' does not have the server 'test'.

Terraform does not automatically rollback in the face of errors..

Steps to Reproduce

Run Example Usage code

@dominik-lekse
Copy link
Contributor

dominik-lekse commented Jun 26, 2017

@holmesb @tombuildsstuff There are three different issues here which make the situation a bit more complicated.

  1. The example usage in the issue does not match the documenation. The example in the documentation contain the correct key names db_min_dtu and db_max_dtu.
  2. When running the example usage, the azurerm_sql_server resource fails since its name test is not unique across the entire Azure environment. This is similar to the name of storage accounts. However, the resulting error is misleading which is a different issue and it is currently not documented in the azurerm_sql_server resource documentation.
  3. In the example usage of the azurerm_sql_elasticpool documentation, the dtu value does not match the pool_size. This needs to be fixed in the documentation of azurerm_sql_elasticpool.
resource "azurerm_sql_elasticpool" "test" {
    name = "test"
    resource_group_name = "${azurerm_resource_group.test.name}"
    location = "West US"
    server_name = "${azurerm_sql_server.test.name}"
    edition = "Basic"
    dtu = 50
    db_dtu_min = 0
    db_dtu_max = 5
    pool_size = 5000
}

@tombuildsstuff
Copy link
Contributor

@dominik-lekse apologies for the delayed response to this

  1. The example usage in the issue does not match the documenation. The example in the documentation contain the correct key names db_min_dtu and db_max_dtu.

I think this comes from an earlier incorrect version of the documentation page

  1. When running the example usage, the azurerm_sql_server resource fails since its name test is not unique across the entire Azure environment. This is similar to the name of storage accounts. However, the resulting error is misleading which is a different issue and it is currently not documented in the azurerm_sql_server resource documentation.

I've updated the documentation to state this needs to be globally unique in #289 - and the examples with a comment to this effect. In addition - I've now updated the code to return a friendlier error if the name is in use - and I'm just working through testing this at the moment.

  1. In the example usage of the azurerm_sql_elasticpool documentation, the dtu value does not match the pool_size. This needs to be fixed in the documentation of azurerm_sql_elasticpool.

I've updated this in the documentation in #289. As such I believe we should be able to close this issue once #289 is merged.

Thanks!

@srusru
Copy link

srusru commented Jul 18, 2018

Hi @tombuildsstuff
i am able to create the azurerm_sql_elasticpool with the basic tier edition. but when i add it as premium tier in the terraform scripts, it throws error.
my script is
resource "azurerm_sql_elasticpool" "elasticpool" {
name = "prod-epool"
resource_group_name = "${azurerm_resource_group.rg.name}"
location = "${azurerm_resource_group.rg.location}"
server_name = "${azurerm_sql_server.sql_server.name}"
edition = "Premium"
dtu = 2000
db_dtu_min = 0
db_dtu_max = 1750
pool_size = 5000
}

The error i get when i execute the terraform script is

  • azurerm_sql_elasticpool.elasticpool: 1 error(s) occurred:

  • azurerm_sql_elasticpool.elasticpool: sql.ElasticPoolsClient#CreateOrUpdate: Failure sending request: StatusCode=0 -- Original Error: json: cannot unmarshal array into Go struct field serviceError2.details of type map[string]interface {}

Any help is appriciated. Thanks

@tombuildsstuff
Copy link
Contributor

@reddyed can you please open a new issue specifically for this? Thanks!

@hashicorp hashicorp locked as resolved and limited conversation to collaborators Jul 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants