{"id":18578956,"url":"https://github.com/libre-devops/terraform-azurerm-mssql-server","last_synced_at":"2026-02-17T21:33:48.297Z","repository":{"id":272637756,"uuid":"917230052","full_name":"libre-devops/terraform-azurerm-mssql-server","owner":"libre-devops","description":"A module used to deploy a MSSQL server 📅","archived":false,"fork":false,"pushed_at":"2025-01-15T20:15:01.000Z","size":52,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-04-08T16:54:49.873Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/libre-devops.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-15T15:47:33.000Z","updated_at":"2025-01-15T20:15:01.000Z","dependencies_parsed_at":"2025-01-15T19:52:58.019Z","dependency_job_id":"6326ca7a-7ffb-4dc3-958a-a1a56889b9c6","html_url":"https://github.com/libre-devops/terraform-azurerm-mssql-server","commit_stats":{"total_commits":3,"total_committers":2,"mean_commits":1.5,"dds":"0.33333333333333337","last_synced_commit":"6bbea97d3801aa1f7aa942945ad657ecb61b5aa7"},"previous_names":["libre-devops/terraform-azurerm-mssql-server"],"tags_count":1,"template":false,"template_full_name":"libre-devops/terraform-module-template","purl":"pkg:github/libre-devops/terraform-azurerm-mssql-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libre-devops%2Fterraform-azurerm-mssql-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libre-devops%2Fterraform-azurerm-mssql-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libre-devops%2Fterraform-azurerm-mssql-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libre-devops%2Fterraform-azurerm-mssql-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/libre-devops","download_url":"https://codeload.github.com/libre-devops/terraform-azurerm-mssql-server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libre-devops%2Fterraform-azurerm-mssql-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29558557,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-17T20:52:40.164Z","status":"ssl_error","status_checked_at":"2026-02-17T20:48:10.325Z","response_time":100,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T23:38:24.749Z","updated_at":"2026-02-17T21:33:43.284Z","avatar_url":"https://github.com/libre-devops.png","language":"PowerShell","funding_links":[],"categories":[],"sub_categories":[],"readme":"```hcl\nresource \"azurerm_mssql_server\" \"this\" {\n  for_each = { for server in var.mssql_servers : server.name =\u003e server }\n\n  location            = each.value.location\n  name                = each.value.name\n  resource_group_name = each.value.rg_name\n  version             = each.value.version\n\n  administrator_login                          = each.value.administrator_login\n  administrator_login_password                 = each.value.administrator_login_password\n  connection_policy                            = each.value.connection_policy\n  transparent_data_encryption_key_vault_key_id = each.value.transparent_data_encryption_key_vault_key_id\n  minimum_tls_version                          = each.value.minimum_tls_version\n  public_network_access_enabled                = each.value.public_network_access_enabled\n  outbound_network_restriction_enabled         = each.value.outbound_network_restriction_enabled\n  primary_user_assigned_identity_id            = each.value.primary_user_assigned_identity_id\n\n\n  dynamic \"azuread_administrator\" {\n    for_each = each.value.azuread_administrator != null ? [each.value.azuread_administrator] : []\n    content {\n      login_username              = azuread_administrator.value.login_username\n      azuread_authentication_only = azuread_administrator.value.azuread_authentication_only\n      object_id                   = azuread_administrator.value.object_id\n      tenant_id                   = azuread_administrator.value.tenant_id\n    }\n  }\n\n\n  dynamic \"identity\" {\n    for_each = each.value.identity_type == \"SystemAssigned\" ? [each.value.identity_type] : []\n    content {\n      type = each.value.identity_type\n    }\n  }\n\n  dynamic \"identity\" {\n    for_each = each.value.identity_type == \"SystemAssigned, UserAssigned\" ? [each.value.identity_type] : []\n    content {\n      type         = each.value.identity_type\n      identity_ids = try(each.value.identity_ids, [])\n    }\n  }\n\n  dynamic \"identity\" {\n    for_each = each.value.identity_type == \"UserAssigned\" ? [each.value.identity_type] : []\n    content {\n      type         = each.value.identity_type\n      identity_ids = length(try(each.value.identity_ids, [])) \u003e 0 ? each.value.identity_ids : []\n    }\n  }\n}\n\nlocals {\n  combined_firewall_rules = flatten([\n    for s in var.mssql_servers : [\n      for fw in(s.firewall_rules != null ? s.firewall_rules : []) : {\n        server_name = s.name\n        rule        = fw\n      }\n    ]\n  ])\n\n  combined_vnet_rules = flatten([\n    for s in var.mssql_servers : [\n      for vnr in(s.vnet_rules != null ? s.vnet_rules : []) : {\n        server_name = s.name\n        vnet_rule   = vnr\n      }\n    ]\n  ])\n}\n\nresource \"azurerm_mssql_firewall_rule\" \"firewall_rules\" {\n  # Each item in local.combined_firewall_rules becomes a resource\n  for_each = {\n    for fr in local.combined_firewall_rules :\n    \"${fr.server_name}-${fr.rule.name}\" =\u003e fr\n  }\n\n  name             = each.value.rule.name\n  server_id        = azurerm_mssql_server.this[each.value.server_name].id\n  start_ip_address = each.value.rule.start_ip_address\n  end_ip_address   = each.value.rule.end_ip_address\n}\n\nresource \"azurerm_mssql_virtual_network_rule\" \"vnet_rules\" {\n  for_each = {\n    for vr in local.combined_vnet_rules :\n    \"${vr.server_name}-${vr.vnet_rule.name}\" =\u003e vr\n  }\n\n  name      = each.value.vnet_rule.name\n  server_id = azurerm_mssql_server.this[each.value.server_name].id\n  subnet_id = each.value.vnet_rule.subnet_id\n}\n\nresource \"azurerm_mssql_server_extended_auditing_policy\" \"extended_auditing_policies\" {\n  for_each = {\n    for server in var.mssql_servers :\n    server.name =\u003e server.extended_auditing_policy\n    if server.extended_auditing_policy != null\n  }\n\n  server_id = azurerm_mssql_server.this[each.key].id\n\n  storage_endpoint = try(each.value.storage_endpoint, null)\n\n  retention_in_days                       = try(each.value.retention_in_days, 0)\n  storage_account_access_key              = try(each.value.storage_account_access_key, null)\n  storage_account_access_key_is_secondary = try(each.value.storage_account_access_key_is_secondary, false)\n  log_monitoring_enabled                  = try(each.value.log_monitoring_enabled, false)\n  predicate_expression                    = try(each.value.predicate_expression, null)\n  storage_account_subscription_id         = try(each.value.storage_account_subscription_id, null)\n\n  audit_actions_and_groups = try(each.value.audit_actions_and_groups, [\"BATCH_COMPLETED_GROUP\"])\n}\n\n```\n## Requirements\n\nNo requirements.\n\n## Providers\n\n| Name | Version |\n|------|---------|\n| \u003ca name=\"provider_azurerm\"\u003e\u003c/a\u003e [azurerm](#provider\\_azurerm) | n/a |\n\n## Modules\n\nNo modules.\n\n## Resources\n\n| Name | Type |\n|------|------|\n| [azurerm_mssql_firewall_rule.firewall_rules](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/mssql_firewall_rule) | resource |\n| [azurerm_mssql_server.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/mssql_server) | resource |\n| [azurerm_mssql_server_extended_auditing_policy.extended_auditing_policies](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/mssql_server_extended_auditing_policy) | resource |\n| [azurerm_mssql_virtual_network_rule.vnet_rules](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/mssql_virtual_network_rule) | resource |\n\n## Inputs\n\n| Name | Description | Type | Default | Required |\n|------|-------------|------|---------|:--------:|\n| \u003ca name=\"input_mssql_servers\"\u003e\u003c/a\u003e [mssql\\_servers](#input\\_mssql\\_servers) | List to deploy mssql servers | \u003cpre\u003elist(object({\u003cbr/\u003e    rg_name                                      = string\u003cbr/\u003e    location                                     = optional(string, \"uksouth\")\u003cbr/\u003e    tags                                         = map(string)\u003cbr/\u003e    name                                         = string\u003cbr/\u003e    version                                      = optional(string, \"12.0\")\u003cbr/\u003e    administrator_login                          = optional(string)\u003cbr/\u003e    administrator_login_password                 = optional(string)\u003cbr/\u003e    identity_type                                = optional(string)\u003cbr/\u003e    identity_ids                                 = optional(list(string))\u003cbr/\u003e    connection_policy                            = optional(string, \"Default\")\u003cbr/\u003e    transparent_data_encryption_key_vault_key_id = optional(string)\u003cbr/\u003e    minimum_tls_version                          = optional(string, \"1.2\")\u003cbr/\u003e    public_network_access_enabled                = optional(bool, false)\u003cbr/\u003e    outbound_network_restriction_enabled         = optional(bool, false)\u003cbr/\u003e    primary_user_assigned_identity_id            = optional(string)\u003cbr/\u003e    azuread_administrator = optional(object({\u003cbr/\u003e      login_username              = string\u003cbr/\u003e      object_id                   = string\u003cbr/\u003e      tenant_id                   = optional(string)\u003cbr/\u003e      azuread_authentication_only = optional(bool)\u003cbr/\u003e    }))\u003cbr/\u003e    firewall_rules = optional(list(object({\u003cbr/\u003e      name             = string\u003cbr/\u003e      start_ip_address = string\u003cbr/\u003e      end_ip_address   = string\u003cbr/\u003e    })))\u003cbr/\u003e    vnet_rules = optional(list(object({\u003cbr/\u003e      name                                 = string\u003cbr/\u003e      subnet_id                            = string\u003cbr/\u003e      ignore_missing_vnet_service_endpoint = optional(bool, false)\u003cbr/\u003e    })))\u003cbr/\u003e    extended_auditing_policy = optional(object({\u003cbr/\u003e      enabled                                 = optional(bool, true)\u003cbr/\u003e      storage_endpoint                        = optional(string)\u003cbr/\u003e      retention_in_days                       = optional(number, 0)\u003cbr/\u003e      storage_account_access_key              = optional(string)\u003cbr/\u003e      storage_account_access_key_is_secondary = optional(bool)\u003cbr/\u003e      log_monitoring_enabled                  = optional(bool, true)\u003cbr/\u003e      storage_account_subscription_id         = optional(string)\u003cbr/\u003e      predicate_expression                    = optional(string)\u003cbr/\u003e      audit_actions_and_groups                = optional(list(string), [\"BATCH_COMPLETED_GROUP\"])\u003cbr/\u003e    }))\u003cbr/\u003e  }))\u003c/pre\u003e | n/a | yes |\n\n## Outputs\n\n| Name | Description |\n|------|-------------|\n| \u003ca name=\"output_mssql_firewall_rule_ids\"\u003e\u003c/a\u003e [mssql\\_firewall\\_rule\\_ids](#output\\_mssql\\_firewall\\_rule\\_ids) | A map of MSSQL Firewall Rule IDs, keyed by \u003cserver\u003e-\u003crule\u003e. |\n| \u003ca name=\"output_mssql_restorable_dropped_database_ids\"\u003e\u003c/a\u003e [mssql\\_restorable\\_dropped\\_database\\_ids](#output\\_mssql\\_restorable\\_dropped\\_database\\_ids) | The ID of the restorable dropped database. |\n| \u003ca name=\"output_mssql_server_fully_qualified_domain_name\"\u003e\u003c/a\u003e [mssql\\_server\\_fully\\_qualified\\_domain\\_name](#output\\_mssql\\_server\\_fully\\_qualified\\_domain\\_name) | The fully qualified domain name of the mssql server. |\n| \u003ca name=\"output_mssql_server_id\"\u003e\u003c/a\u003e [mssql\\_server\\_id](#output\\_mssql\\_server\\_id) | The ID of the mssql server. |\n| \u003ca name=\"output_mssql_server_identity\"\u003e\u003c/a\u003e [mssql\\_server\\_identity](#output\\_mssql\\_server\\_identity) | The identity of the mssql server. |\n| \u003ca name=\"output_mssql_server_name\"\u003e\u003c/a\u003e [mssql\\_server\\_name](#output\\_mssql\\_server\\_name) | The name of the mssql server. |\n| \u003ca name=\"output_mssql_vnet_rule_ids\"\u003e\u003c/a\u003e [mssql\\_vnet\\_rule\\_ids](#output\\_mssql\\_vnet\\_rule\\_ids) | A map of MSSQL VNet Rule IDs, keyed by \u003cserver\u003e-\u003crule\u003e. |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibre-devops%2Fterraform-azurerm-mssql-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flibre-devops%2Fterraform-azurerm-mssql-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibre-devops%2Fterraform-azurerm-mssql-server/lists"}