Skip to content

DeimosCloud/terraform-azure-mssql

Repository files navigation

MSSQL Azure

A terraform module for MSSQL Database creation

Basic Usage

module "mssql" {
  source = "git::https://gitlab.com/deimosdev/tooling/terraform-modules/terraform-mssql-azure"

  database_names       = ["test"]
  resource_group_name = azurerm_resource_group.resource_group.name

  tags = {
    environment = "TEST"
    costcenter  = "it"
    managed     = "terraform"
  }
}

Creating vnet firewall rule

Generates the vnet rule name by default, or a vnet-rule name to use can be optionally passed

module "mssql" {
  source = "git::https://gitlab.com/deimosdev/tooling/terraform-modules/terraform-mssql-azure"

  database_name       = ["test", "test2"] # Creates multiple database on the same server
  resource_group_name = azurerm_resource_group.resource_group.name
  create_vnet_rule    = true
  subnet_id           = var.subnet_id  # The subnet must have Microsoft.Sql service endpoint enabled

  tags = {
    environment = "TEST"
    costcenter  = "it"
    managed     = "terraform"
  }
}

Creating Private link Endpoints

Generates the private link endpoint name by default, or a private-link endpoint name to use can be optionally passed

module "mssql" {
  source = "git::https://gitlab.com/deimosdev/tooling/terraform-modules/terraform-mssql-azure"

  database_names           = ["test"]
  resource_group_name     = azurerm_resource_group.resource_group.name
  create_private_endpoint = true
  subnet_id               = var.subnet_id  # The subnet must enable private link endpoints

  tags = {
    environment = "TEST"
    costcenter  = "it"
    managed     = "terraform"
  }
}

Contributing

Report issues/questions/feature requests on in the issues section.

Full contributing guidelines are covered here.

Requirements

Name Version
terraform >= 0.12
azurerm ~> 2.0

Providers

Name Version
azurerm ~> 2.0
random n/a

Inputs

Name Description Type Default Required
admin_login_name The administrator login name for the SQL Server string "" no
allow_access_to_azure_services Makes server accessible to Authenticated requests from Azure services bool false no
clients_ip A list of client IPs to be whitelisted for access to SQL Server. Example [{start_ip: 0.0.0.0, end_ip: 0.0.0.1},] list(map(string)) [] no
create_private_endpoint Whether to create a private endpoint access for the SQL Server. The subnet id must be provided ifthis is true bool false no
create_server Whether to create SQL Server or not. Specifying false means a server_id must be provided to work with bool true no
create_vnet_rule whether to create the vnet rule bool false no
database_names A list of database names to be created in the same server. Changing this forces a new resource to be created. list [] no
max_size_gb the max size of the database in gigabytes. number 20 no
private_dns_zone_name The Private DNS Zone to use to create the Private FQDN for the SQL server if private. Once specified, an FQDN is created for the Private Link any null no
private_endpoint_name The name of the private endpoint to be created. If not provided it is autogenerated when create_private_endpoint is true string "" no
private_fqdn_subdomain The subdomain to deploy database on for the private_dns_zone string ".database" no
public_network_access_enabled Whether or not public network access is allowed for this server bool false no
resource_group_name The name of the resource group where the SQL server resides any n/a yes
server_id The SQL Server ID to be used to create DB. If specified, the a new SQL Server is not created any null no
server_name The name of the server to be created string "" no
server_version The version of the MSSQL server. string "12.0" no
subnet_id The subnet id to attach private_endpoint/vnet firewall rule to string "" no
tags Tags to be passed to created instances map {} no
vnet_rule_name The name of the SQL virtual network rule to be created string "" no

Outputs

Name Description
database_names The name of the created database
private_endpoint_ip_address The private IP address associated with the private endpoint
private_fqdn The private FQDN of the SQL Server based on the associated Private Endpoint
private_link_endpoint_id The ID of the private endpoint
private_link_endpoint_name The name of the private endpoint
server_administrator_login Administrator Login username
server_administrator_login_password Administration login password
server_domain_name The fully qualified domain name of the Azure SQL Server (e.g. myServerName.database.windows.net
server_id The id of the server the MSSQL database was provisioned on
server_name The name of the server the MSSQL database was provisioned on

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages