New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve terraform import
. Add help for all atmos
commands
#94
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
60adc8a
Update `terraform import`
aknysh d71e985
`atmos help`
aknysh e4c2299
`atmos help`
aknysh 916f73e
`atmos help`
aknysh 1ced371
`atmos help`
aknysh 436bb33
`atmos help`
aknysh b9c7e08
`atmos help`
aknysh 40c04f5
`atmos help`
aknysh bec3263
`atmos help`
aknysh 4b8f7ab
`atmos help`
aknysh b95ade4
`atmos help`
aknysh ac688a0
`atmos help`
aknysh f2d857a
`atmos help`
aknysh a9fec1c
`atmos help`
aknysh 24600dd
`atmos help`
aknysh File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea, nice find.
it's opinionated since Go is a very explicit language