azurerm_sql_server

Manages a SQL Azure Database Server.

Example Usage

resource "azurerm_resource_group" "test" {
  name     = "database-rg"
  location = "West US"
}

resource "azurerm_sql_server" "test" {
  name                         = "mysqlserver"
  resource_group_name          = "${azurerm_resource_group.test.name}"
  location                     = "${azurerm_resource_group.test.location}"
  version                      = "12.0"
  administrator_login          = "mradministrator"
  administrator_login_password = "thisIsDog11"

  tags {
    environment = "production"
  }
}

Argument Reference

The following arguments are supported:

  • name - (Required) The name of the SQL Server. This needs to be globally unique within Azure.

  • resource_group_name - (Required) The name of the resource group in which to create the SQL Server.

  • location - (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.

  • version - (Required) The version for the new server. Valid values are: 2.0 (for v11 server) and 12.0 (for v12 server).

  • administrator_login - (Required) The administrator login name for the new server. Changing this forces a new resource to be created.

  • administrator_login_password - (Required) The password associated with the administrator_login user. Needs to comply with Azure's Password Policy

  • tags - (Optional) A mapping of tags to assign to the resource.

Attributes Reference

The following attributes are exported:

  • id - The SQL Server ID.
  • fully_qualified_domain_name - The fully qualified domain name of the Azure SQL Server (e.g. myServerName.database.windows.net)

Import

SQL Servers can be imported using the resource id, e.g.

terraform import azurerm_sql_server.test /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/providers/Microsoft.Sql/servers/myserver

© 2018 HashiCorp
Licensed under the MPL 2.0 License.
https://www.terraform.io/docs/providers/azurerm/r/sql_server.html