-
-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update `terraform import` * `atmos help` * `atmos help` * `atmos help` * `atmos help` * `atmos help` * `atmos help` * `atmos help` * `atmos help` * `atmos help` * `atmos help` * `atmos help` * `atmos help` * `atmos help` * `atmos help`
- Loading branch information
Showing
17 changed files
with
154 additions
and
52 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
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
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
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
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
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
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 exec | ||
|
||
import ( | ||
"fmt" | ||
"github.com/fatih/color" | ||
) | ||
|
||
// processHelp processes help commands | ||
func processHelp(componentType string, command string) error { | ||
if len(command) == 0 { | ||
fmt.Println(fmt.Sprintf("'atmos' supports all native '%s' commands.", componentType)) | ||
fmt.Println(fmt.Sprintf("In addition, 'component' and 'stack' are required in order to generate variables for the component in the stack.")) | ||
color.Cyan(fmt.Sprintf("atmos %s <command> <component> -s <stack> [options]", componentType)) | ||
color.Cyan(fmt.Sprintf("atmos %s <command> <component> --stack <stack> [options]", componentType)) | ||
|
||
if componentType == "terraform" { | ||
fmt.Println() | ||
color.Cyan("Differences from native terraform:") | ||
fmt.Println(" - before executing other 'terraform' commands, 'atmos' calls 'terraform init'") | ||
fmt.Println(" - 'atmos' supports 'terraform deploy' command which calls 'terraform plan' and then 'terraform apply'") | ||
fmt.Println(" - 'terraform deploy' command supports '--deploy-run-init=true/false' flag to enable/disable running 'terraform init' " + | ||
"before executing the command") | ||
fmt.Println(" - 'terraform deploy' command sets '-auto-approve' flag before running 'terraform apply'") | ||
fmt.Println(" - 'terraform apply' and 'terraform deploy' commands support '--from-plan' flag. If the flag is specified, the commands " + | ||
"will use the previously generated 'planfile' instead of generating a new 'varfile'") | ||
fmt.Println(" - 'atmos' supports 'terraform clean' command which deletes the '.terraform' folder, '.terraform.lock.hcl' lock file, " + | ||
"and the previously generated 'planfile' and 'varfile' for the specified component and stack") | ||
fmt.Println(" - 'atmos terraform workspace' command first calls 'terraform init -reconfigure', then 'terraform workspace select', " + | ||
"and if the workspace was not created before, it then calls 'terraform workspace new'") | ||
fmt.Println(" - 'atmos terraform import' looks for 'region' in the variables for the specified component and stack, and if it finds it, " + | ||
"sets 'AWS_REGION=<region>' ENV var before executing the command") | ||
} | ||
|
||
if componentType == "helmfile" { | ||
fmt.Println() | ||
color.Cyan("Differences from native helmfile:") | ||
fmt.Println(" - 'atmos helmfile' commands support '[global options]' in the command-line argument '--global-options'. " + | ||
"Usage: atmos helmfile <command> <component> -s <stack> [command options] [arguments...] --global-options=\"--no-color --namespace=test\"") | ||
fmt.Println(" - before executing the 'helmfile' commands, 'atmos' calls 'aws eks update-kubeconfig' to read kubeconfig from the EKS cluster " + | ||
"and use it to authenticate with the cluster") | ||
} | ||
|
||
err := execCommand(componentType, []string{"--help"}, "", nil) | ||
if err != nil { | ||
return err | ||
} | ||
} else { | ||
fmt.Println(fmt.Sprintf("'atmos' supports native '%s %s' command with all the options, arguments and flags.", componentType, command)) | ||
fmt.Println(fmt.Sprintf("In addition, 'component' and 'stack' are required in order to generate variables for the component in the stack.")) | ||
color.Cyan(fmt.Sprintf("atmos %s %s <component> -s <stack> [options]", componentType, command)) | ||
color.Cyan(fmt.Sprintf("atmos %s %s <component> --stack <stack> [options]", componentType, command)) | ||
|
||
err := execCommand(componentType, []string{command, "--help"}, "", nil) | ||
if err != nil { | ||
return err | ||
} | ||
} | ||
|
||
fmt.Println() | ||
return nil | ||
} |
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
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