_This issue was originally opened by @thcp as hashicorp/terraform#24999. It was migrated here as a result of the provider split. The original body of the issue is below._
Terraform v0.12.25
+ provider.azurerm v2.10.0
resource "azurerm_resource_group" "db" {
# var.azure_region == westeurope
name = "database-${terraform.workspace}-${var.azure_region}-rg"
location = var.azure_region
tags = {
environment = terraform.workspace
source = "terraform"
module_version = "v1.0"
}
}
resource "azurerm_mysql_server" "sample" {
name = "sample"
location = azurerm_resource_group.db.location
resource_group_name = azurerm_resource_group.db.name
administrator_login = "sampleadmin"
administrator_login_password = "somthing1234!"
sku_name = "B_Gen5_1"
storage_mb = 5120
version = "5.7"
backup_retention_days = 7
geo_redundant_backup_enabled = false
public_network_access_enabled = false
ssl_enforcement_enabled = false
}
resource "azurerm_mysql_database" "sample" {
name = "sample"
resource_group_name = azurerm_resource_group.db.name
server_name = azurerm_mysql_server.sample.name
charset = "utf8"
collation = "utf8_unicode_ci"
}
Error: creating MySQL Server "unicred" (Resource Group "database-unicredit-westeurope-rg"): mysql.ServersClient#Create: Failure sending request: StatusCode=405 -- Original Error: Code="FeatureSwitchNotEnabled" Message="Requested feature is not enabled"
on 80-database.tf line 19, in resource "azurerm_mysql_server" "unicred":
19: resource "azurerm_mysql_server" "unicred" {
mysql server should be created
Terraform doesnt create the mysql server
terraform init ; terraform apply
Adapted from the example: https://www.terraform.io/docs/providers/azurerm/r/mysql_server.html
Same issue with postgreSQL: https://github.com/terraform-providers/terraform-provider-azurerm/issues/6959
i have the same problem, i tried version v2.8.0 through v2.11.0.
Here is my example for v2.11.0:
resource "azurerm_mysql_server" "example" {
name = "${local.resourcename}"
resource_group_name = module.resourcegroup.name
location = module.resourcegroup.location
administrator_login = data.azurerm_key_vault_secret.AdministratorLogin.value
administrator_login_password = data.azurerm_key_vault_secret.AdministratorPassword.value
sku_name = "B_Gen5_2"
storage_mb = 20480
version = "8.0"
auto_grow_enabled = true
backup_retention_days = 7
geo_redundant_backup_enabled = false
infrastructure_encryption_enabled = true
public_network_access_enabled = false
ssl_enforcement_enabled = false
}
Error: creating MySQL Server "resource" (Resource Group "resourcegroup"): mysql.ServersClient#Create: Failure sending request: StatusCode=405 -- Original Error: Code="FeatureSwitchNotEnabled" Message="Requested feature is not enabled"
Regarding Mysql Server, its not an error. I just verified that the Basic Tier for Mysql doesnt support access via private IP. for the same code used on the example, if we bypass public_network_access_enabled
since the default value is True, I can create the server properly.
This issue can be closed.
jep, using public_network_access_enabled: true
works for me
using sku_name = "GP_Gen5_2"
and public_network_access_enabled = false
works
@sebastianreloaded Yea, its quite clear on the docs, i just noticed that a few hours before opening the ticket here but i didnt had time to come back:
https://docs.microsoft.com/en-us/azure/mysql/concepts-data-access-security-private-link
thanks for opening this @sebastianreloaded - looks like we'll have to add some validation for this so we can return a more user friendly error message.
Having the same issues despite setting the flag public_network_access_enabled = true
as Basic tier does not support Private link. I had the code working for a few weeks and now it's complaining.
resource "azurerm_mysql_server" "metrics_mysql" {
name = "test-sample-metrics-mysqlserver"
location = "australiasoutheast"
resource_group_name = "${var.azure_rg}"
administrator_login = "xxxxxx"
administrator_login_password = "xxxxxx"
sku_name = "B_Gen5_1"
storage_mb = 5120
version = "5.7"
backup_retention_days = 7
geo_redundant_backup_enabled = false
auto_grow_enabled = true
public_network_access_enabled = true
infrastructure_encryption_enabled = true
ssl_enforcement_enabled = true
ssl_minimal_tls_version_enforced = "TLS1_2"
}
Here's the output
creating MySQL Server "test-sample-metrics-mysqlserver" (Resource Group "commons-nonprod-main-rg"): mysql.ServersClient#Create: Failure sending request: StatusCode=405 -- Original Error: Code="FeatureSwitchNotEnabled" Message="Requested feature is not enabled"
on metrics-mysql.tf line 1, in resource "azurerm_mysql_server" "metrics_mysql":
1: resource "azurerm_mysql_server" "metrics_mysql" {
FeatureSwitchNotEnabled
Am I missing something here ?
I had the same, check that infrastructure_encryption is supported in your location/region. Changing to false, should solve your issue.
Is there any more details from Azure it could log? Like the feature in error.
Most helpful comment
Is there any more details from Azure it could log? Like the feature in error.