/terraform-az-sqlserver

Azure Terraform module for creating SQL Server

Primary LanguageHCLMIT LicenseMIT

Create Azure SQL Server

Reference the module to a specific version (recommended):

module "sql_server" {
    source = "git://github.com/melvinlee/terraform-az-sqlserver.git?ref=v0.1"
    name = var.name
    location = var.location
    resource_group_name = var.resource_group_name
    ...
}

Or get the latest version

source = "git://github.com/melvinlee/terraform-az-sqlserver.git?ref==vlatest"

Parameters

name

variable "name" {
  description = "(Required) The name of the Azure SQL Server to create."
  type        = string
}

resource_group_name

variable "resource_group_name" {
  type        = string
  description = "(Required) Name of the resource group where to create the Azure SQL Server"
}

location

variable "location" {
    type = string
    description = "(Required) Define the region where the Azure SQL Server will be created"
}

databases_map

variable "databases_map" {
    description = "(Optional) Create one or more Azure SQL Database"
    default = {}
}

Example: To create one than one databases

databases_map = {
    database_1 = {
      name      = "db1-1"
      collation = "SQL_LATIN1_GENERAL_CP1_CS_AS"
      edition   = "Standard"
    },
    database_2 = {
      name      = "db-2"
      collation = "SQL_LATIN1_GENERAL_CP1_CS_AS"
      edition   = "Standard"
    }
  }

allow_azure_service

variable "allow_azure_service" {
    type = bool
    description = "(Optional) Allow Azure SQL Database server accepts communication from any subnet inside the Azure boundary"
    default = false
}

tags

variable "tags" {
    description = "(Required) Map of tags for the deployment"
}

Output

Name Description
server_name SQL Server name
fully_qualified_domain_name SQL Server full qualified domain name(FQDN)
administrator_login Administrator login id
administrator_login_password Administrator login password

Contribute

Pull requests are welcome to evolve this module and integrate new features.