diff --git a/deployment/config.go b/deployment/config.go index a875395d5..f9e79b0e7 100644 --- a/deployment/config.go +++ b/deployment/config.go @@ -323,6 +323,10 @@ func (c *Config) IsValid() error { return err } + if err := c.validateProxyConfig(); err != nil { + return err + } + if err := c.validateDBName(); err != nil { return err } @@ -330,6 +334,13 @@ func (c *Config) IsValid() error { return nil } +func (c *Config) validateProxyConfig() error { + if c.AppInstanceCount > 1 && c.ProxyInstanceCount < 1 && c.ServerURL == "" { + return fmt.Errorf("the deployment will create more than one app node, but no proxy is being deployed and no external proxy has been configured: either set ProxyInstanceCount to 1, or set ServerURL to the URL of an external proxy") + } + return nil +} + // DBName returns the database name for the deployment. func (c *Config) DBName() string { if c.TerraformDBSettings.DBName != "" {