Skip to content

Commit 16f1fa4

Browse files
author
Anmol Nagpal
committed
server config resource modified fpr audit_log_enabled
1 parent fab5acc commit 16f1fa4

File tree

4 files changed

+40
-39
lines changed

4 files changed

+40
-39
lines changed

examples/mysql-flexible-server-replication/main.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,14 @@ module "flexible-mysql" {
8080
db_name = "maindb"
8181
charset = "utf8"
8282
collation = "utf8_unicode_ci"
83-
server_configuration_name = "interactive_timeout"
8483
auto_grow_enabled = true
8584
iops = 360
8685
size_gb = "20"
8786
existing_private_dns_zone = true
8887
existing_private_dns_zone_id = data.azurerm_private_dns_zone.main.id
8988
existing_private_dns_zone_name = data.azurerm_private_dns_zone.main.name
9089

91-
90+
##azurerm_mysql_flexible_server_configuration
91+
server_configuration_names = ["interactive_timeout", "audit_log_enabled"]
92+
values = ["600", "ON"]
9293
}

examples/mysql-flexible-server/main.tf

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -52,28 +52,31 @@ module "subnet" {
5252

5353

5454
module "flexible-mysql" {
55-
depends_on = [module.resource_group, module.vnet]
56-
source = "../.."
57-
name = "app"
58-
environment = "test"
59-
label_order = ["name", "environment"]
60-
resource_group_name = module.resource_group.resource_group_name
61-
location = module.resource_group.resource_group_location
62-
virtual_network_id = module.vnet.vnet_id[0]
63-
delegated_subnet_id = module.subnet.default_subnet_id[0]
64-
mysql_version = "8.0.21"
65-
mysql_server_name = "testmysqlserver"
66-
private_dns = true
67-
zone = "1"
68-
admin_username = "mysqlusername"
69-
admin_password = "ba5yatgfgfhdsv6A3ns2lu4gqzzc"
70-
sku_name = "GP_Standard_D8ds_v4"
71-
db_name = "maindb"
72-
charset = "utf8"
73-
collation = "utf8_unicode_ci"
74-
server_configuration_name = "interactive_timeout"
75-
auto_grow_enabled = true
76-
iops = 360
77-
size_gb = "20"
55+
depends_on = [module.resource_group, module.vnet]
56+
source = "../.."
57+
name = "app"
58+
environment = "test"
59+
label_order = ["name", "environment"]
60+
resource_group_name = module.resource_group.resource_group_name
61+
location = module.resource_group.resource_group_location
62+
virtual_network_id = module.vnet.vnet_id[0]
63+
delegated_subnet_id = module.subnet.default_subnet_id[0]
64+
mysql_version = "8.0.21"
65+
mysql_server_name = "testmysqlserver"
66+
private_dns = true
67+
zone = "1"
68+
admin_username = "mysqlusername"
69+
admin_password = "ba5yatgfgfhdsv6A3ns2lu4gqzzc"
70+
sku_name = "GP_Standard_D8ds_v4"
71+
db_name = "maindb"
72+
charset = "utf8mb3"
73+
collation = "utf8mb3_unicode_ci"
74+
auto_grow_enabled = true
75+
iops = 360
76+
size_gb = "20"
77+
78+
##azurerm_mysql_flexible_server_configuration
79+
server_configuration_names = ["interactive_timeout", "audit_log_enabled"]
80+
values = ["600", "ON"]
7881

7982
}

main.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ resource "azurerm_mysql_flexible_database" "main" {
5858
}
5959

6060
resource "azurerm_mysql_flexible_server_configuration" "main" {
61-
count = var.enabled ? 1 : 0
62-
name = var.server_configuration_name
61+
count = var.enabled ? length(var.server_configuration_names) : 0
62+
name = element(var.server_configuration_names, count.index)
6363
resource_group_name = local.resource_group_name
6464
server_name = join("", azurerm_mysql_flexible_server.main.*.name)
65-
value = var.value
65+
value = element(var.values, count.index)
6666
}
6767

6868
##------------------------------------------------------------------------

variables.tf

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -190,13 +190,6 @@ variable "existing_private_dns_zone_name" {
190190
description = " The name of the Private DNS zone (without a terminating dot). Changing this forces a new resource to be created."
191191
}
192192

193-
variable "value" {
194-
type = string
195-
default = "600"
196-
description = "Specifies the value of the MySQL Flexible Server Configuration. See the MySQL documentation for valid values. Changing this forces a new resource to be created."
197-
}
198-
199-
200193
variable "auto_grow_enabled" {
201194
type = bool
202195
default = false
@@ -229,10 +222,14 @@ variable "collation" {
229222
default = ""
230223
description = "Specifies the Collation for the MySQL Database, which needs to be a valid MySQL Collation. Changing this forces a new resource to be created."
231224
}
232-
variable "server_configuration_name" {
233-
type = string
234-
default = ""
225+
variable "server_configuration_names" {
226+
type = list(string)
227+
default = []
235228
description = "Specifies the name of the MySQL Flexible Server Configuration, which needs to be a valid MySQL configuration name. Changing this forces a new resource to be created."
236229
}
237230

238-
231+
variable "values" {
232+
type = list(string)
233+
default = []
234+
description = "Specifies the value of the MySQL Flexible Server Configuration. See the MySQL documentation for valid values. Changing this forces a new resource to be created."
235+
}

0 commit comments

Comments
 (0)