Add TLSConfig support to monitoring module (#182)

- Allows MySQL TLS Config to be set to connect to MySQL over TLS.
Default: `true`
This commit is contained in:
Jorge Falcon authored and GitHub committed 2026-02-23 15:00:44 -05:00
1 parent bf8b38c19e
commit e7a026671d
3 files changed
+4

No files matched your search

+2
View File
@@ -51,6 +51,7 @@ type OptionsStruct struct {
MySQLUser string `long:"mysql-user" env:"MYSQL_USER" required:"true"`
MySQLSMSecret string `long:"mysql-secretsmanager-secret" env:"MYSQL_SECRETSMANAGER_SECRET" required:"true"`
MySQLDatabase string `long:"mysql-database" env:"MYSQL_DATABASE" required:"true"`
MySQLTLSConfig string `long:"mysql-tls-config" env:"MYSQL_TLS_CONFIG" default:"true"`
FleetEnv string `long:"fleet-environment" env:"FLEET_ENV" required:"true"`
AWSRegion string `long:"aws-region" env:"AWS_REGION" required:"true"`
CronDelayTolerance string `long:"cron-delay-tolerance" env:"CRON_DELAY_TOLERANCE" default:"2h"`
@@ -157,6 +158,7 @@ func setupDB(snsClient *sns.Client) (db *sql.DB, err error) {
DBName: options.MySQLDatabase,
AllowNativePasswords: true,
ParseTime: true,
TLSConfig: options.MySQLTLSConfig,
}
db, err = sql.Open("mysql", cfg.FormatDSN())
+1
View File
@@ -407,6 +407,7 @@ resource "aws_lambda_function" "cron_monitoring" {
MYSQL_DATABASE = var.cron_monitoring.mysql_database
MYSQL_USER = var.cron_monitoring.mysql_user
MYSQL_SECRETSMANAGER_SECRET = data.aws_secretsmanager_secret.mysql_database_password[0].name
MYSQL_TLS_CONFIG = var.cron_monitoring.mysql_tls_config
CRON_SYSTEM_MONITOR_SNS_TOPIC_ARNS = join(",", lookup(var.sns_topic_arns_map, "cron_monitoring", var.default_sns_topic_arns))
CRON_JOB_FAILURE_MONITOR_SNS_TOPIC_ARNS = join(",", lookup(var.sns_topic_arns_map, "cron_job_failure_monitoring", var.default_sns_topic_arns))
FLEET_ENV = var.customer_prefix
+1
View File
@@ -86,6 +86,7 @@ variable "cron_monitoring" {
mysql_database = string
mysql_user = string
mysql_password_secret_name = string
mysql_tls_config = optional(string, "true")
vpc_id = string
subnet_ids = list(string)
rds_security_group_id = string