我有以下资源可以使用 terraform 创建 sql server 和数据库
# Configure the Microsoft Azure Provider
provider "azurerm" {
version = "0.2.2"
}
# ...
resource "azurerm_sql_server" "demo" {
name = "${var.sql_server_name}"
resource_group_name = "${azurerm_resource_group.demo.name}"
location = "${azurerm_resource_group.demo.location}"
version = "12.0"
administrator_login = "${var.sql_server_account}"
administrator_login_password = "${var.sql_server_password}"
}
# Create SQL Database
resource "azurerm_sql_database" "demo" {
name = "demo"
resource_group_name = "${azurerm_resource_group.demo.name}"
location = "${azurerm_resource_group.demo.location}"
server_name = "${azurerm_sql_server.demo.name}"
}
当我运行 terraform plan 时,它说它将创建这些资源,但是在运行 terraform apply 时出现此错误:
Error applying plan:
1 error(s) occurred:
* azurerm_sql_server.demo: 1 error(s) occurred:
* azurerm_sql_server.demo: sql.ServersClient#CreateOrUpdate: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="Unknown" Message="Unknown service error"
Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.
我尝试更改正在使用的 azurerm 插件的版本,但没有任何改变。我使用 azurerm 插件版本 0.2.2,版本 0.2.1 出现同样的错误,0.2.0 不适用于其他一些资源。