You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Terraform supports MySQL Flexible server configuration using azurerm_mysql_flexible_server_configuration resources, one for each configuration entry. An addition to the variables.tf file with a supporting variable in addition to the configuration resource using a for_each loop would be ideal.
Example implementation (including locals for universal defaults): variables.tf
variable"mysql_configuration_items" {
description="(Optional) Map of MySQL configurations to enable on the flexible server. Defaults to `{}`"type=map(string)
default={}
}
main.tf
(see #51 & #52 for why these locals could be included as defaults)
locals {
mysql_logging_configuration=var.enable_audit_log? {
"audit_log_enabled"="ON",
"audit_log_events"="ADMIN,CONNECTION,DCL,DDL",
} : {}
mysql_default_configuration_items=merge( local.mysql_logging_configuration, {
"sql_generate_invisible_primary_key"="OFF", # resolves recent issues reported by REDCap database checks when using MySQL v8
}
}
...
resource "azurerm_mysql_flexible_server_configuration""config_item" {
for_each =merge(local.mysql_default_configuration_items, var.mysql_configuration_items)
resource_group_name = azurerm_resource_group.redcap.name
name = each.key
server_name = azurerm_mysql_flexible_server.redcap.name
value = each.value
}
While not as familiar with the other deployment options, I assume an analog could be created for those deployment options as well.
This will facilitate a number of other features, including enabling audit logging on the MySQL server, addressing the sql_generate_invisible_primary_key issue with MySQL 8.x (see REDCap community entries on that issue), and others.
epopisces
changed the title
Add support for arbitrary number of azurerm_mysql_flexible_server_configuration resources in Terraform
Terraform: add support for arbitrary number of azurerm_mysql_flexible_server_configuration resources
Nov 20, 2023
Side note: I know I'm putting a number of issues on the board. I will try to get some time to fork this project and implement some of these fixes for the Terraform side of things, and submit a PR in the near future.
This is an awesome project, and I'd love to see it make others' REDCap journey on Azure smoother and more successful!
@epopisces Thanks for contributing the issues. We are actively discussing the value in maintaining the Terraform code. It's likely we will discontinue it and only maintain the Bicep.
Terraform supports MySQL Flexible server configuration using azurerm_mysql_flexible_server_configuration resources, one for each configuration entry. An addition to the variables.tf file with a supporting variable in addition to the configuration resource using a for_each loop would be ideal.
Example implementation (including locals for universal defaults):
variables.tf
main.tf
(see #51 & #52 for why these locals could be included as defaults)
While not as familiar with the other deployment options, I assume an analog could be created for those deployment options as well.
This will facilitate a number of other features, including enabling audit logging on the MySQL server, addressing the sql_generate_invisible_primary_key issue with MySQL 8.x (see REDCap community entries on that issue), and others.
Example usage in a tfvars file:
The text was updated successfully, but these errors were encountered: