This repository has been archived by the owner on Aug 18, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Rover v2 Draft Proposal
Ben Coleman edited this page Jun 14, 2021
·
32 revisions
Design and agree command structure for Rover v2
- Remove all top level commands (
ci
,cd
,landingzone
,launchpad
) and promote the verb/action to the top level - Use of symphony or not, is simply determined by the flags, e.g.
--config-dir
(standalone mode) vs--config-file
(symphony ci/cd mode) - Launchpad mode goes back to being a flag, e.g.
--launchpad
and the enforced "level0" requirement is removed -
ci_tasks
directory is renamedcustom_commands
and used for ONLY defining & running external commands, tflint, terratest etc.- Custom commands integrate themselves into the rover CLI as actions, e.g. I define a task
foo
it is runnable withrover foo
- Proposed custom command definition below, with a variable substitution syntax to pass params such as source directory or config path to the arguments of the exe being run.
- Custom commands integrate themselves into the rover CLI as actions, e.g. I define a task
# Example with "standalone mode" for persona-a
rover apply --config-dir app/myconfg --source app/landingzones --level level3 --env foo --state-name blah
# Example with "Symphony mode" for persona-b
rover apply --config-file symphony.yaml --level3
# More examples but for a launchpad
rover destroy --launchpad --config-dir app/myconfg --source app/landingzones --level level0 --env foo --state-name mylaunchpad
rover destroy --config-file symphony.yaml --level0
# All terraform actions are supported, no need for CI special case
rover init --config-file symphony.yaml --level1
rover plan --config-file symphony.yaml --level1
rover fmt --config-file symphony.yaml --level1
rover validate --config-file symphony.yaml --level1
Example of customcommands
e.g. custom_commands/tflint.yaml
name: linter
executableName: "tflint"
arguments: ["--config", "/somepath/mylinter.conf", "{{SOURCE_DIR}}"]
if run with rover linter --config-dir blah --source /blah/mylandingzones
it would call tflint --config /somepath/mylinter.conf /blah/mylandingzones/caf_solution
-
landingzone
-
init
- init -
apply
- plan AND apply -
plan
- plan only -
destroy
- destroy -
fmt
- format -
validate
- validate -
(BenC: Removed for now)test
- initiates a terratest execution -
(BenC: Removed for now)run
- plan, apply and test -
list
- replaces current --landingzone operation to list deployed zones -
fetch
- replaces current --clone operation
-
-
launchpad
- It is felt that this is such a special case it should be it's own command-
init
- init -
apply
- plan AND apply -
plan
- plan only -
destroy
- destroy with special handling for destroying a launchpad -
fmt
- format -
validate
- validate -
(BenC: Removed for now)test
- initiates a terratest execution -
(BenC: Removed for now)run
- plan, apply and test
-
-
walkthrough
- Initiate a rover walkthrough to set up an initial project scaffold. -
workspace
- Wrapper to call terraform workspace commands, is this really required? -
terraform
- Drop down and run an arbitrary terraform command but under the rover context e.g. logged in user creds etc -
login
- Will be a stub, I see no value in duplicating az login behaviour -
logout
- Will be a stub for now, I see no value in duplicating az logout behaviour -
ci
-
{tool}
- name of the specific ci task/tool to run from ci_task definitions, dynamically discovered
-
-
cd
-
init
- init -
apply
- plan AND apply -
plan
- plan only -
destroy
- destroy, with special handling for destroying a launchpad -
(BenC: Removed for now)test
- initiates a terratest execution -
(BenC: Removed for now)run
- plan, apply and test
-
-
--level
specify desired level to deploy to -
--symphony-config
Symphony YAML config file
-
--config-path
Configuration vars directory (required) -
--environment
ame of CAF environment (default "sandpit") -
--level
Level (default "level1") NOTE.launchpad
command omits this flag and fixes the level to "level0" -
--source
Path to source of landingzone (required) -
--state-sub
Azure subscription ID where state is held -
--statename
Name for state and plan files, (default landingzone source dir name) -
--target-sub
Azure subscription ID to operate on -
--workspace
Name of workspace (default "tfstate")
-
--log-level
Specify the desired log level. -
--cloud
Name of the specific Azure Cloud. (BenC: should this be global? what if I'm just running an init or fmt?) -
--base-path
Starting path for symphony. (BenC: this should not be a global flag it only applies to CI and CD commands) -
--debug
Switch on extra debug info. (BenC: this has already been implemented) --help
-
--version
(BenC: this has already been implemented) -
--config
(BenC: Loads in rover.yaml config, it remains to be seen if a dedicated rover config file is required, it has been supporting the spike/experiment efforts so far)
- Rovergo should support relative paths and work regardless of where the rover tool is installed. (BenC: done, but ongoing)
- Rovergo should not be required to be in /tf/rover. (BenC: Done)
- Support for Devcontainer and Code Space should be maintained. (BenC: I don't expect this to change, but the dockerfile and devcontainer will need work, & simplifying)
- Rovergo should have a complete set of unit test and integration tests.
- Installable binary with
go get
andcurl https://raw.githubusercontent.com/aztfmod/rovergo/install.sh | bash
- Binaries for Linux, Windows and MacOS _(BenC: Done using goreleaser)
- Rovergo CI pipeline and PR workflow. (BenC: Done)
Questions:
- Should we support legacy rover commands or make this a clean break?
# old syntax
rover -lz $CAF_DIR/caf_modules/landingzones/caf_launchpad \
-launchpad \
-var-folder $CAF_DIR/config_launchpad/level0/launchpad \
-parallelism 30 \
-level level0 \
-env ${caf_environment} \
-a apply
# *** New syntax (ACTUAL as of 4th June) ***
# Note - No need to specify caf_landingzone or caf_solution in source path
# Note - With launchpad command level0 is assumed
rover launchpad run \
--source $CAF_DIR/landingzones \
--config-path $CAF_DIR/configs/level0/launchpad \
--environment demo \
--action apply
rover launchpad run \
--source $CAF_DIR/landingzones \
--config-path $CAF_DIR/configs/level0/launchpad \
--environment demo \
--action destroy
rover landingzone run \
--source $CAF_DIR/landingzones \
--config-path $CAF_DIR/configs/level1/foundation \
--environment demo \
--level level1 \
--action apply
# Some example CD commands (PROPOSED)
CD actions / modes:
- run : plan, apply and test (default)
- apply: plan, apply
- test: perform test
- destroy: remove
## Symphony yaml defaults to current folder.
rover cd # deploy all
rover cd apply --level level0 # deploy level0
rover cd apply --level level1 # deploy level1
rover cd apply --level level2 # deploy level1
rover cd apply --level level3 # deploy level1
rover cd apply --level level4 # deploy level1
## Optional: pass in symphony yaml path.
rover cd --config=all/symphony.yml # deploy all
rover cd apply --level level0 --config=launchpad/symphony.yml # deploy level0, note launchpad mode determined by launchpad:true in symphony.yml
rover cd apply --level level1 --config=platform/symphony.yml # deploy level1
rover cd apply --level level2 --config=platform/symphony.yml # deploy level1
rover cd apply --level level3 --config=solution/symphony.yml # deploy level1
rover cd apply --level level4 --config=solution/symphony.yml # deploy level1
rover cd --config=all/symphony.yml # destroy all
rover cd destroy --level level0 --config=launchpad/symphony.yml # destroy level0
rover cd destroy --level level1 --config=platform/symphony.yml # destroy level1
rover cd destroy --level level2 --config=platform/symphony.yml # destroy level1
rover cd destroy --level level3 --config=solution/symphony.yml # destroy level1
rover cd destroy --level level4 --config=solution/symphony.yml # destroy level1
rover cd --config=all/symphony.yml # test all
rover cd test --level level0 --config=launchpad/symphony.yml # test level0
rover cd test --level level1 --config=platform/symphony.yml # test level1
rover cd test --level level2 --config=platform/symphony.yml # test level1
rover cd test --level level3 --config=solution/symphony.yml # test level1
rover cd test --level level4 --config=solution/symphony.yml # test level1#