-
-
Notifications
You must be signed in to change notification settings - Fork 998
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce run-all to replace xxx-all (#1520)
* Introduce run-all to replace xxx-all * Fix bug in terraformcliargs manipulation with run-all update * Fix regression bug with xxx-all where OriginalTerraformCommand was not set correctly * Consolidate deprecated commands handler * Track a list of commands that should never be run with run-all * Make sure to pass -input=false to all commands that require them * Update cli/cli_app.go Co-authored-by: Yevgeniy Brikman <[email protected]> * Add state command to promptable run-all * Fix bugs from logging changes * Fix more issues from logging Co-authored-by: Yevgeniy Brikman <[email protected]>
- Loading branch information
1 parent
a7c0d43
commit 7b2e875
Showing
12 changed files
with
314 additions
and
223 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package cli | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
|
||
"github.com/gruntwork-io/terragrunt/options" | ||
) | ||
|
||
func spinUpDeprecationHandler(origOptions *options.TerragruntOptions) (*options.TerragruntOptions, string, string) { | ||
return origOptions, CMD_APPLY_ALL, CMD_APPLY_ALL | ||
} | ||
|
||
func tearDownDeprecationHandler(origOptions *options.TerragruntOptions) (*options.TerragruntOptions, string, string) { | ||
return origOptions, CMD_DESTROY_ALL, CMD_DESTROY_ALL | ||
} | ||
|
||
func applyAllDeprecationHandler(origOptions *options.TerragruntOptions) (*options.TerragruntOptions, string, string) { | ||
opts := origOptions.Clone(origOptions.TerragruntConfigPath) | ||
opts.TerraformCommand = "apply" | ||
opts.OriginalTerraformCommand = "apply" | ||
opts.TerraformCliArgs = append([]string{"apply"}, opts.TerraformCliArgs...) | ||
newCmdFriendly := fmt.Sprintf("terragrunt run-all %s", strings.Join(opts.TerraformCliArgs, " ")) | ||
return opts, CMD_RUN_ALL, newCmdFriendly | ||
} | ||
|
||
func destroyAllDeprecationHandler(origOptions *options.TerragruntOptions) (*options.TerragruntOptions, string, string) { | ||
opts := origOptions.Clone(origOptions.TerragruntConfigPath) | ||
opts.TerraformCommand = "destroy" | ||
opts.OriginalTerraformCommand = "destroy" | ||
opts.TerraformCliArgs = append([]string{"destroy"}, opts.TerraformCliArgs...) | ||
newCmdFriendly := fmt.Sprintf("terragrunt run-all %s", strings.Join(opts.TerraformCliArgs, " ")) | ||
return opts, CMD_RUN_ALL, newCmdFriendly | ||
} | ||
|
||
func planAllDeprecationHandler(origOptions *options.TerragruntOptions) (*options.TerragruntOptions, string, string) { | ||
opts := origOptions.Clone(origOptions.TerragruntConfigPath) | ||
opts.TerraformCommand = "plan" | ||
opts.OriginalTerraformCommand = "plan" | ||
opts.TerraformCliArgs = append([]string{"plan"}, opts.TerraformCliArgs...) | ||
newCmdFriendly := fmt.Sprintf("terragrunt run-all %s", strings.Join(opts.TerraformCliArgs, " ")) | ||
return opts, CMD_RUN_ALL, newCmdFriendly | ||
} | ||
|
||
func validateAllDeprecationHandler(origOptions *options.TerragruntOptions) (*options.TerragruntOptions, string, string) { | ||
opts := origOptions.Clone(origOptions.TerragruntConfigPath) | ||
opts.TerraformCommand = "validate" | ||
opts.OriginalTerraformCommand = "validate" | ||
opts.TerraformCliArgs = append([]string{"validate"}, opts.TerraformCliArgs...) | ||
newCmdFriendly := fmt.Sprintf("terragrunt run-all %s", strings.Join(opts.TerraformCliArgs, " ")) | ||
return opts, CMD_RUN_ALL, newCmdFriendly | ||
} | ||
|
||
func outputAllDeprecationHandler(origOptions *options.TerragruntOptions) (*options.TerragruntOptions, string, string) { | ||
opts := origOptions.Clone(origOptions.TerragruntConfigPath) | ||
opts.TerraformCommand = "output" | ||
opts.OriginalTerraformCommand = "output" | ||
opts.TerraformCliArgs = append([]string{"output"}, opts.TerraformCliArgs...) | ||
newCmdFriendly := fmt.Sprintf("terragrunt run-all %s", strings.Join(opts.TerraformCliArgs, " ")) | ||
return opts, CMD_RUN_ALL, newCmdFriendly | ||
} |
Oops, something went wrong.