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.61k stars 4.66k forks source link

HS_PRMS SKU in azurerm_mssql_elasticpool gives the error This is not a valid sku name #24788

Closed erwabo closed 6 months ago

erwabo commented 10 months ago

Is there an existing issue for this?

Community Note

Terraform Version

1.6.6

AzureRM Provider Version

3.87.0

Affected Resource(s)/Data Source(s)

azurerm_mssql_elasticpool

Terraform Configuration Files

resource "azurerm_mssql_elasticpool" "main" {
  depends_on          = [azurerm_mssql_server.main]
  name                = "ep${var.company_name}${var.envtype}"
  resource_group_name = var.rgname
  location            = var.region
  server_name         = azurerm_mssql_server.main.name
  max_size_gb         = var.ep_size
  license_type        = var.ep_license
  sku {
    name     = var.ep_name   
    tier     = var.ep_edition  
    family   = var.ep_compute_gen 
    capacity = var.ep_cores       
  }
  per_database_settings {
    min_capacity = "0"
    max_capacity = var.ep_cores
  }
  tags = {
    EnvType       = var.envtype
    SiteName      = "${var.cloudsitename}.${var.domain}"
    SuppressUntil = ""
  }
  lifecycle {
    ignore_changes = [tags]
  }
}

Debug Output/Panic Output

╵
╷
│ Error: expected sku.0.name to be one of ["BasicPool" "StandardPool" "PremiumPool" "GP_Gen4" "GP_Gen5" "GP_Fsv2" "GP_DC" "BC_Gen4" "BC_Gen5" "BC_DC" "HS_Gen5"], got HS_PRMS
│ 
│   with module.SQL.azurerm_mssql_elasticpool.main,
│   on modules/SQL/main.tf line 55, in resource "azurerm_mssql_elasticpool" "main":
│   55:     name     = var.ep_name        
│ 
╵
╷
│ Error: Cannot apply incomplete plan

Expected Behaviour

Resource should have been deployed with sku HS_PRMS

Actual Behaviour

[error]custom_ep_sku variable is not properly cased, or not one of the following: GP_Gen4 GP_Gen5 GP_Fsv2 GP_DC BC_Gen4 BC_Gen5 BC_DC HS_Gen5. Value provided was: HS_PRMS

Steps to Reproduce

No response

Important Factoids

No response

References

No response

rcskosir commented 10 months ago

Thank you for taking the time to open this feature request! I am linking this previous PR that added similar support just to pull in relevant context. #23974 I am not familiar enough with HS_PRMS to know if that needs to be added as its own enhancement, or if you should be using one of the SKUs that was added in the above PR, so I wanted to leave the attached PR to see if it helps you with any troubleshooting.

craigminihan commented 8 months ago

@rcskosir I'm seeing the same issue, my workaround of using Gen5 with ignore_changes for tier/family/capacity causes Terraform to fail if the SLO has been changed to PRMS in the Portal.

The error I see is:

╷
│ Error: service tier 'Hyperscale' PRMS must have a 'capacity'(4) of  vCores
│
│   with module.sql001.azurerm_mssql_elasticpool.ep,
│   on modules\sql\main.tf line 84, in resource "azurerm_mssql_elasticpool" "ep":
│   84: resource "azurerm_mssql_elasticpool" "ep" {
│
╵

I'd expect the ignore to avoid any evaluation of tier/familty/capacity to occur in TF. The workaround means my IaC is broken and I'll have to revert back to Gen5. In essence this should work but doesn't with hashicorp/azurerm 3.95:

  sku {
    name = "HS_PRMS"
    tier = "Hyperscale"
    capacity = 4
    family = "PRMS"
  }

As noted above the error is:

╷
│ Error: expected sku.0.name to be one of ["BasicPool" "StandardPool" "PremiumPool" "GP_Gen4" "GP_Gen5" "GP_Fsv2" "GP_DC" "BC_Gen4" "BC_Gen5" "BC_DC" "HS_Gen5"], got HS_PRMS
│
│   with module.sql001.azurerm_mssql_elasticpool.ep,
│   on modules\sql\main.tf line 106, in resource "azurerm_mssql_elasticpool" "ep":
│  106:     name = var.sku_name
│
╵
╷
│ Error: expected sku.0.family to be one of ["Gen4" "Gen5" "Fsv2" "DC"], got PRMS
│
│   with module.sql001.azurerm_mssql_elasticpool.ep,
│   on modules\sql\main.tf line 109, in resource "azurerm_mssql_elasticpool" "ep":
│  109:     family = var.sku_family
│
╵

The ARM markup for the resource is currently:

  "sku": {
      "name": "HS_PRMS",
      "tier": "Hyperscale",
      "family": "PRMS",
      "capacity": 4
  }

Note: 4 seems to be the minimum capacity

github-actions[bot] commented 5 months 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 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.