hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.6k stars 4.64k forks source link

No way to specify Azure Data Warehouse Gen 2 #5196

Closed ghost closed 4 years ago

ghost commented 4 years ago

This issue was originally opened by @Ethan-Arrowood as hashicorp/terraform#23690. It was migrated here as a result of the provider split. The original body of the issue is below.


Terraform Version

Terraform v0.12.16
+ provider.azurerm v1.38.0

Terraform Configuration Files

resource "azurerm_sql_server" "sql_server" {
  name = var.sql_server_name
  resource_group_name = azurerm_resource_group.rg.name
  location = azurerm_resource_group.rg.location
  version = "12.0"
  administrator_login = "etarrowo"
  administrator_login_password = "abcdef"

  tags = {
    environment = var.environment
  }
}

resource "azurerm_sql_database" "sql_dw" {
  name = var.sql_dw_name
  resource_group_name = azurerm_resource_group.rg.name
  location = azurerm_resource_group.rg.location
  server_name = azurerm_sql_server.sql_server.name
  edition = "DataWarehouse"
  requested_service_objective_name = "DW100"

  tags = {
    environment = var.environment
  }
}

Crash Output

azurerm_sql_database.sql_dw: Creating...

Error: Error issuing create/update request for SQL Database "etar-sql-dw-1" (Resource Group "learn-terraform", Server "etar-sql-server-1"): sql.DatabasesClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: Code="Failed" Message="The async operation failed." InnerError={"unmarshalError":"json: cannot unmarshal array into Go struct field serviceError2.details of type map[string]interface {}"} AdditionalInfo=[{"code":"45122","details":[{"code":"45122","message":"'Gen1 Data Warehouse has been deprecated in this region. Please leverage Gen2 Data Warehouse.'","severity":"16","target":null}],"innererror":[],"message":"'Gen1 Data Warehouse has been deprecated in this region. Please leverage Gen2 Data Warehouse.'","target":null}]

  on sql-dw-deployment.tf line 29, in resource "azurerm_sql_database" "sql_dw":
  29: resource "azurerm_sql_database" "sql_dw" {

Expected Behavior

An Azure SQL Server and DataWarehouse is created

Actual Behavior

SQL Server is created successfully, but SQL DataWarehouse fails on invalid generation type

Steps to Reproduce

  1. terraform init
  2. terraform plan -var 'location=east us' -var 'rg_name=learn-terraform' -var 'sql_server_name=etar-sql-server-1' -var 'sql_dw_name=etar-sql-dw-1' -var 'environment=testing' -out out-1.tfplan
  3. terraform apply out-1.tfplan

Additional Context

This is being run directly from Azure Cloud Shell on a resource group with Terraform installed.

References

mehdi-kimakhe-amido commented 4 years ago

I think you didn't use the correct "requested service objective name" (DW100). Can you try with this:

requested_service_objective_name = "DW100c"

Maybe the error code should be changed.

Ethan-Arrowood commented 4 years ago

This was it! -- Can I ask we document this more clearly? I'm happy to do the work just need to know where to contribute.

katbyte commented 4 years ago

@Ethan-Arrowood, it would probably be best to add it to the SQL resource documentation

neil-yechenwei commented 4 years ago

Hopes this PR would be helpful.

ghost commented 4 years ago

This has been released in version 2.17.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
    version = "~> 2.17.0"
}
# ... other configuration ...
ghost commented 4 years ago

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!