From dd49eb78ee9d09657ed2207be891dcf5c6e3247c Mon Sep 17 00:00:00 2001 From: Lorna Song Date: Tue, 26 Apr 2022 11:18:49 -0400 Subject: [PATCH] Fix syslog enabled value Context: syslog should be automatically enabled if other fields (e.g. facility or name) values are provided. This is documented in CTS Issue: syslog enabled field has to be specifically set to true. Otherwise it is false even though other config fields are provided. This was caused by the default was set to enabled=false. When CTS builds the config, the user-provided config is merged with the default config. If the user left enabled unconfigured, it would merge with the default enabled=false. This results in enabled being set to false in a way that looks as though the user set enabled to false. Related: https://github.com/hashicorp/consul-terraform-sync/issues/812 --- config/syslog.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/syslog.go b/config/syslog.go index bb5b7cd8a..b040e6a04 100644 --- a/config/syslog.go +++ b/config/syslog.go @@ -26,7 +26,8 @@ type SyslogConfig struct { // DefaultSyslogConfig returns the default configuration struct. func DefaultSyslogConfig() *SyslogConfig { return &SyslogConfig{ - Enabled: Bool(false), + // No default values. `Enabled` value depends on other fields as + // handled in Finalize() } }