File tree Expand file tree Collapse file tree 3 files changed +21
-4
lines changed
examples/PostgreSQL_Server Expand file tree Collapse file tree 3 files changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ module "postgresql-db" {
4646
4747 # The URL to a Key Vault custom managed key
4848 key_vault_key_id = var.key_vault_key_id
49-
49+ */
5050 # To enable Azure Defender for database set `enable_threat_detection_policy` to true
5151 enable_threat_detection_policy = true
5252 log_retention_days = 30
@@ -58,8 +58,8 @@ module "postgresql-db" {
5858
5959 # (Optional) To enable Azure Monitoring for Azure MySQL database
6060 # (Optional) Specify `storage_account_name` to save monitoring logs to storage.
61- log_analytics_workspace_name = "loganalytics-we-sharedtest2"
62- */
61+ // log_analytics_workspace_name = "loganalytics-we-sharedtest2"
62+
6363 # Firewall Rules to allow azure and external clients and specific Ip address/ranges.
6464 firewall_rules = {
6565 access-to-azure = {
Original file line number Diff line number Diff line change @@ -140,7 +140,7 @@ resource "azurerm_postgresql_configuration" "main" {
140140}
141141
142142# ------------------------------------------------------------
143- # Adding Firewall rules for MySQL Server - Default is "false"
143+ # Adding Firewall rules for PostgreSQL Server - Default is "false"
144144# ------------------------------------------------------------
145145resource "azurerm_postgresql_firewall_rule" "main" {
146146 for_each = var. firewall_rules != null ? { for k , v in var . firewall_rules : k => v if v != null } : {}
@@ -150,3 +150,15 @@ resource "azurerm_postgresql_firewall_rule" "main" {
150150 start_ip_address = each. value [" start_ip_address" ]
151151 end_ip_address = each. value [" end_ip_address" ]
152152}
153+
154+ # ----------------------------------------------------------
155+ # Adding AD Admin to PostgreSQL Server - Default is "false"
156+ # ----------------------------------------------------------
157+ resource "azurerm_postgresql_active_directory_administrator" "main" {
158+ count = var. ad_admin_login_name != null ? 1 : 0
159+ server_name = azurerm_postgresql_server. main . name
160+ resource_group_name = local. resource_group_name
161+ login = var. ad_admin_login_name
162+ tenant_id = data. azurerm_client_config . current . tenant_id
163+ object_id = data. azurerm_client_config . current . object_id
164+ }
Original file line number Diff line number Diff line change @@ -124,6 +124,11 @@ variable "firewall_rules" {
124124 default = null
125125}
126126
127+ variable "ad_admin_login_name" {
128+ description = " The login name of the principal to set as the server administrator"
129+ default = null
130+ }
131+
127132variable "tags" {
128133 description = " A map of tags to add to all resources"
129134 type = map (string )
You can’t perform that action at this time.
0 commit comments