diff --git a/cmd/ltctl/main.go b/cmd/ltctl/main.go index ee7584e5c..218f1ec32 100644 --- a/cmd/ltctl/main.go +++ b/cmd/ltctl/main.go @@ -34,7 +34,7 @@ func RunCreateCmdF(cmd *cobra.Command, args []string) error { return fmt.Errorf("failed to create SSH agent: %w", err) } - initData := config.DBDumpURI == "" + initData := config.DBDumpURI == "" && config.ExternalDBSettings.DataSource == "" if err = t.Create(extAgent, initData); err != nil { return fmt.Errorf("failed to create terraform env: %w", err) } diff --git a/deployment/config.go b/deployment/config.go index fbf0f9a5d..abc8b254c 100644 --- a/deployment/config.go +++ b/deployment/config.go @@ -398,6 +398,10 @@ func (c *Config) IsValid() error { return fmt.Errorf("load-test download url is not in correct format: %q", c.LoadTestDownloadURL) } + if c.ExternalDBSettings.DataSource != "" && c.DBDumpURI != "" { + return fmt.Errorf("both ExternalDBSettings.DataSource and DBDumpURI are set, only one can be set") + } + if err := c.validateElasticSearchConfig(); err != nil { return err } diff --git a/docs/config/deployer.md b/docs/config/deployer.md index 11abbf8ba..c19d0581b 100644 --- a/docs/config/deployer.md +++ b/docs/config/deployer.md @@ -556,6 +556,10 @@ The file is expected to be gzip compressed. This can also point to a local file if prefixed with "file://". In such case, the dump file will be uploaded to the app servers. +Loading a dump into a database only work for terraform created databases. +If you are using an existing database by relying on [`ExternalDBSettings`](#ExternalDBSettings) +you need to load the dump manually. + ## SiteURL *string*