我正在使用Terraform在Azure上配置基础架构。我正在使用Terraform模板创建SQL数据库,我可以创建数据库,但默认情况下为数据库设置了标准计划。是否可以使用模板将计划配置为基本计划?
这是我正在使用的模板: -
resource "azurerm_resource_group" "test" {
name = "Test-ResourceGroup"
location = "Central India"
}
resource "azurerm_sql_server" "test" {
name = "name-test-dev"
resource_group_name = "${azurerm_resource_group.test.name}"
location = "Central India"
version = "12.0"
administrator_login = "test-admin"
administrator_login_password = "test-password"
}
resource "azurerm_sql_database" "test" {
name = "test-dev"
resource_group_name = "${azurerm_resource_group.test.name}"
location = "Central India"
server_name = "${azurerm_sql_server.test.name}"
}
答案 0 :(得分:2)
将数据库上的edition
argument设置为Basic
resource "azurerm_sql_database" "test" {
name = "test-dev"
edition = "Basic"
resource_group_name = "${azurerm_resource_group.test.name}"
location = "Central India"
server_name = "${azurerm_sql_server.test.name}"
}
答案 1 :(得分:0)
希望帮助
使用SQL脚本初始化
创建Azure SQL Server数据库https://registry.terraform.io/modules/metadevpro/sqlserver-seed/azurerm/1.0.0
module "azurerm_sql_sever_init" {
source = "Azure/database-seed/azurerm"
location = "westeurope"
resource_group = "myresourcegroup007"
db_server_fqdn = "${azurerm_sql_server.db1.fully_qualified_domain_name}"
sql_admin_username = "${azurerm_sql_server.db1.administrator_login}"
sql_admin_password = "${azurerm_sql_server.db1.administrator_login_password}"
db_name = "mydatabase"
init_script_file = "mydatabase.init.sql"
log_file = "mydatabase.init.log"
tags = {
environment = "qa"
project = "acme"
provisioner = "terraform"
}
}