Skip to content

Terraform module to create SQL server and database

Notifications You must be signed in to change notification settings

Ensono/terraform-azurerm-sql

Repository files navigation

Terraform Azure SQL Server

This module creates a SQL server, database, firewall rules and a private endpoint to be used with the Ensono Stacks Azure Data project.

To use the module reference the GitHub repo in the Terraform file, for example:

module "ado_sql_server" {
    source = "github.com/ensono/terraform-azurerm-sql"
    ...
}

Requirements

No requirements.

Providers

Name Version
azurerm n/a
random n/a

Modules

No modules.

Resources

Name Type
azurerm_mssql_database.example-db resource
azurerm_mssql_firewall_rule.example_fw_rule resource
azurerm_mssql_server.example resource
azurerm_private_endpoint.pe resource
random_password.password resource
azurerm_private_dns_zone.sql_pvt_dns data source

Inputs

Name Description Type Default Required
administrator_login The administrator login name for the new server. Required unless azuread_authentication_only in the azuread_administrator block is true. When omitted, Azure will generate a default username which cannot be subsequently changed. Changing this forces a new resource to be created. string n/a yes
auto_pause_delay_in_minutes Time in minutes after which database is automatically paused. A value of -1 means that automatic pause is disabled. This property is only settable for General Purpose Serverless databases. number 60 no
azuread_administrator Specifies whether only AD Users and administrators (like azuread_administrator.0.login_username) can be used to login, or also local database users (like administrator_login). When true, the administrator_login and administrator_login_password properties can be omitted.
list(object({
login_username = string
object_id = string
}))
[] no
collation Specifies the collation of the database. Changing this forces a new resource to be created. string "SQL_Latin1_General_CP1_CI_AS" no
create_mode The create mode of the database. Possible values are Copy, Default, OnlineSecondary, PointInTimeRestore, Recovery, Restore, RestoreExternalBackup, RestoreExternalBackupSecondary, RestoreLongTermRetentionBackup and Secondary. Mutually exclusive with import. Changing this forces a new resource to be created. string "Default" no
dns_resource_group_name Name of the resource group where pvt dns is present. string "amido-stacks-euw-de-hub-network" no
enable_private_network Determines if the Key Vault will be created as part of the Secure Data Platform. bool false no
is_manual_connection Does the Private Endpoint require Manual Approval from the remote resource owner? Changing this forces a new resource to be created. bool false no
license_type Specifies the license type applied to this database. Possible values are LicenseIncluded and BasePrice. string "LicenseIncluded" no
location_name_map Each region must have corresponding a shortend name for resource naming purposes map(string)
{
"eastasia": "ase",
"eastus": "use",
"eastus2": "use2",
"northeurope": "eun",
"southeastasia": "asse",
"uksouth": "uks",
"ukwest": "ukw",
"westeurope": "euw",
"westus": "usw"
}
no
name_component Component Name - should/will be used in conventional resource naming. Typically this will be a logical name for this part of the system i.e. API || middleware or more generic like Billing string "sql" no
pe_resource_group_location Location of the resource group to provision private endpoint in. string "" no
pe_resource_group_name Name of the resource group to provision private endpoint in. string "" no
pe_subnet_id ID for the Private Endpoint Subnet string "" no
private_dns_zone_name Specifies the Name of the Private DNS Zone Group. string "privatelink.database.windows.net" no
public_network_access_enabled Whether public network access is allowed for this server. Defaults to true. bool true no
resource_group_location Location of Resource group string "uksouth" no
resource_group_name name of resource group string n/a yes
resource_namer User defined naming convention applied to all resources created as part of this module string n/a yes
resource_tags Map of tags to be applied to all resources created as part of this module map(string) {} no
sample_name Specifies the name of the sample schema to apply when creating this database. Possible value is AdventureWorksLT string "AdventureWorksLT" no
sku_name Specifies the name of the SKU used by the database. For example, GP_S_Gen5_2,HS_Gen4_1,BC_Gen5_2, ElasticPool, Basic,S0, P2 ,DW100c, DS100. Changing this from the HyperScale service tier to another service tier will create a new resource. string "Basic" no
sql_db_names The name of the MS SQL Database. Changing this forces a new resource to be created. list(string)
[
"sqldbtest"
]
no
sql_fw_rules Allows you to manage an Azure SQL Firewall Rule.
list(object({
name = string
start_ip_address = string
end_ip_address = string
}))
[
{
"end_ip_address": "0.0.0.0",
"name": "SQLFirewallRule1",
"start_ip_address": "0.0.0.0"
}
]
no
sql_version The version for the new server. Valid values are: 2.0 (for v11 server) and 12.0 (for v12 server). Changing this forces a new resource to be created. string "12.0" no
zone_redundant Whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones. This property is only settable for Premium and Business Critical databases. bool false no

Outputs

Name Description
sql_sa_login n/a
sql_sa_password n/a
sql_server_id n/a
sql_server_name n/a

About

Terraform module to create SQL server and database

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages