-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This reworks the flags feature and refactors a lot of the code under the hood to change the design and fix some issues. * Fix the --help issue. Previously, --help didn't work at all and resulted in an error: `pflag: help requested` (see #1). This fixes that issue and also improves the printing of user flags in the --help text. User flags are now shown at the bottom, separate from builtin and global astro flags. E.g.: ``` $ astro plan --help Generate execution plans for modules Usage: astro plan [flags] [-- [Terraform argument]...] Flags: --detach disconnect remote state before planning -h, --help help for plan --modules string list of modules to plan Global Flags: --config string config file --trace trace output -v, --verbose verbose output User flags: --env string Environment to deploy --region string Region to deploy $ ``` * Previously, Terraform variable names were remapped to a different flag name by specifying the `flag:` option in the variable config, e.g.: ``` - name: app path: core/app variables: - name: aws_region flag: region ``` This meant if you had many modules defined with the same variable, you had to type out the mapping correctly every time or else you would get an error. The mapping configuration has now moved to its own block in the project config, which now looks like: ``` flags: aws_region: name: region description: Region to deploy ``` Users can now also specify a description that will appear in the --help text. Note that the flags section is completely optional, and be default astro will just expose the full variable name as the CLI flag. * Refactoring The implementation of user/project flags did a lot of the error checking in the cli/astro package itself, however, we want to move in a direction where those checks occur in the core astro package. The CLI should be a thin wrapper around the core package.
- Loading branch information
Showing
18 changed files
with
489 additions
and
267 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
--- | ||
|
||
terraform: | ||
version: 0.11.7 | ||
path: ../../../../../fixtures/mock-terraform/success | ||
|
||
modules: | ||
- name: foo_mgmt | ||
|
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
--- | ||
|
||
terraform: | ||
version: 0.11.7 | ||
path: ../../../../../fixtures/mock-terraform/success | ||
|
||
modules: | ||
- name: foo | ||
|
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 |
---|---|---|
@@ -1,14 +1,18 @@ | ||
--- | ||
|
||
terraform: | ||
version: 0.11.7 | ||
path: ../../../../../fixtures/mock-terraform/success | ||
|
||
flags: | ||
bar: | ||
name: baz | ||
description: Baz Description | ||
|
||
modules: | ||
- name: foo | ||
- name: fooModule | ||
path: . | ||
variables: | ||
- name: no_flag | ||
- name: with_flag | ||
flag: flag_name | ||
- name: with_values | ||
- name: foo | ||
- name: bar | ||
- name: qux | ||
values: [dev, staging, prod] |
Oops, something went wrong.