diff --git a/command/agent/retry_join.go b/command/agent/retry_join.go index 66b5851df..c3e9bf475 100644 --- a/command/agent/retry_join.go +++ b/command/agent/retry_join.go @@ -69,8 +69,15 @@ func (r *retryJoiner) Validate(config *Config) error { if config.Server.RetryMaxAttempts != 0 { return fmt.Errorf("server_join and retry_max cannot both be defined; try defining only server_join") } - if config.Server.RetryInterval != "0" { - return fmt.Errorf("server_join and retry_interval cannot both be defined; prefer setting the server_join parameter") + if config.Server.RetryInterval != "0" && config.Server.RetryInterval != "" { + // 30s is the default value that is set, ignore if this is the case + if config.Server.RetryInterval != "30s" { + return fmt.Errorf("server_join and retry_interval cannot both be defined; prefer setting the server_join parameter") + } + } + + if len(config.Server.ServerJoin.RetryJoin) != 0 && len(config.Server.ServerJoin.StartJoin) != 0 { + return fmt.Errorf("server_join and start_join cannot both be defined in the same stanza") } } diff --git a/command/agent/retry_join_test.go b/command/agent/retry_join_test.go index 4f875772f..d5479cfb0 100644 --- a/command/agent/retry_join_test.go +++ b/command/agent/retry_join_test.go @@ -358,6 +358,21 @@ func TestRetryJoin_Validate(t *testing.T) { isValid: true, reason: "server deprecated retry_join configuration should be valid", }, + { + config: &Config{ + Server: &ServerConfig{ + RetryInterval: "30s", + ServerJoin: &ServerJoin{ + RetryJoin: []string{"127.0.0.1"}, + RetryMaxAttempts: 0, + RetryInterval: time.Duration(20) * time.Second, + StartJoin: []string{}, + }, + }, + }, + isValid: true, + reason: "ignore default value for retry interval", + }, } joiner := retryJoiner{}