diff --git a/README.md b/README.md index f83c4b6b..e7414ffe 100644 --- a/README.md +++ b/README.md @@ -116,6 +116,7 @@ One way to customize the behavior of this module is through CLI flag values pass |------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------| | `--autoplan` | The default value for autoplan settings. Can be overriden by locals. | false | | `--automerge` | Enables the automerge setting for a repo. | false | +| `--auto-discover` | Enables the auto discovery settings for the repo. | true | | `--cascade-dependencies` | When true, dependencies will cascade, meaning that a module will be declared to depend not only on its dependencies, but all dependencies of its dependencies all the way down. | true | | `--ignore-parent-terragrunt` | Ignore parent Terragrunt configs (those which don't reference a terraform module).
In most cases, this should be set to `true` | true | | `--parallel` | Enables `plan`s and `apply`s to happen in parallel. Will typically be used with `--create-workspace` | true | diff --git a/cmd/config.go b/cmd/config.go index c7776bdc..7a5704c5 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -16,6 +16,9 @@ type AtlantisConfig struct { // If Atlantis should merge after finishing `atlantis apply` AutoMerge bool `json:"automerge"` + // If Atlantis should do a autodiscovery when dont have projects in config + AutoDiscover *Autodiscover `json:"autodiscover"` + // If Atlantis should allow plans to occur in parallel ParallelPlan bool `json:"parallel_plan"` @@ -66,6 +69,11 @@ type AutoplanConfig struct { Enabled bool `json:"enabled"` } +// Autodiscover settings +type Autodiscover struct { + Enabled bool +} + // Checks if an output file already exists. If it does, it reads it // in to preserve some parts of the old config func readOldConfig() (*AtlantisConfig, error) { diff --git a/cmd/generate.go b/cmd/generate.go index 0836f3e8..7337e3a5 100644 --- a/cmd/generate.go +++ b/cmd/generate.go @@ -688,6 +688,7 @@ func main(cmd *cobra.Command, args []string) error { config := AtlantisConfig{ Version: 3, AutoMerge: autoMerge, + AutoDiscover: &Autodiscover{Enabled: autoDiscover}, ParallelPlan: parallel, ParallelApply: parallel, } @@ -895,6 +896,7 @@ func main(cmd *cobra.Command, args []string) error { var gitRoot string var autoPlan bool var autoMerge bool +var autoDiscover bool var ignoreParentTerragrunt bool var createParentProject bool var ignoreDependencyBlocks bool @@ -934,6 +936,7 @@ func init() { generateCmd.PersistentFlags().BoolVar(&autoPlan, "autoplan", false, "Enable auto plan. Default is disabled") generateCmd.PersistentFlags().BoolVar(&autoMerge, "automerge", false, "Enable auto merge. Default is disabled") + generateCmd.PersistentFlags().BoolVar(&autoDiscover, "auto-discover", true, "Enable auto discover when dont spicify any project in the config. Default is enabled") generateCmd.PersistentFlags().BoolVar(&ignoreParentTerragrunt, "ignore-parent-terragrunt", true, "Ignore parent terragrunt configs (those which don't reference a terraform module). Default is enabled") generateCmd.PersistentFlags().BoolVar(&createParentProject, "create-parent-project", false, "Create a project for the parent terragrunt configs (those which don't reference a terraform module). Default is disabled") generateCmd.PersistentFlags().BoolVar(&ignoreDependencyBlocks, "ignore-dependency-blocks", false, "When true, dependencies found in `dependency` blocks will be ignored") diff --git a/cmd/golden/autodiscover_disabled.yaml b/cmd/golden/autodiscover_disabled.yaml new file mode 100644 index 00000000..e81675a7 --- /dev/null +++ b/cmd/golden/autodiscover_disabled.yaml @@ -0,0 +1,5 @@ +automerge: true +autodiscover: false +parallel_apply: true +parallel_plan: true +version: 3