Skip to content

Commit

Permalink
Issue 152 cli v1.9.0 release update (#141)
Browse files Browse the repository at this point in the history
* ISSUE-152 Adding documentation to reflect the 1.9.0 release: layers and tfautomv

* ISSUE-152 Adding documentation to reflect the 1.9.0 release: note on S3 keys generation

* ISSUE-152 Added new compatibility matrix

* ISSUE-152 added notes
  • Loading branch information
juanmatias authored Jan 13, 2023
1 parent e56e186 commit b0d3505
Show file tree
Hide file tree
Showing 8 changed files with 235 additions and 15 deletions.
4 changes: 3 additions & 1 deletion docs/user-guide/leverage-cli/install-leverage-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,16 @@ Options:
-l, --list-tasks List available tasks to run.
-v, --verbose Increase output verbosity.
--version Show the version and exit.
-h, --help Show this message and exit.
--help Show this message and exit.

Commands:
aws Run AWS CLI commands in a custom containerized environment.
credentials Manage AWS cli credentials.
project Manage a Leverage project.
run Perform specified task(s) and all of its dependencies.
terraform Run Terraform commands in a custom containerized...
tf Run Terraform commands in a custom containerized...
tfautomv Run TFAutomv commands in a custom containerized...
```

##Installation in an isolated environment
Expand Down
6 changes: 4 additions & 2 deletions docs/user-guide/leverage-cli/reference/basic-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@ Options:
-l, --list-tasks List available tasks to run.
-v, --verbose Increase output verbosity.
--version Show the version and exit.
-h, --help Show this message and exit.
--help Show this message and exit.

Commands:
aws Run AWS CLI commands in a custom containerized environment.
credentials Manage AWS cli credentials.
project Manage a Leverage project.
run Perform specified task(s) and all of its dependencies.
terraform Run Terraform commands in a custom containerized...
tf Run Terraform commands in a custom containerized...
tfautomv Run TFAutomv commands in a custom containerized...
```

Similarly, subcommands provide further information by means of the `--help` flag. For example `leverage tf --help`.
Expand All @@ -39,5 +41,5 @@ Tasks in build file `build.py`:
start_server [Default] Start the server
stop_server
Powered by Leverage 1.0.10
Powered by Leverage 1.9.0
```
25 changes: 20 additions & 5 deletions docs/user-guide/leverage-cli/reference/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,16 @@ Equivalent to `terraform init`.

All arguments given are passed as received to Terraform.

Can only be run at **layer** level.
Can only be run at **layer** level if `--layers` is not set, or at **account** or **layers-container-directory** if it is.

[Layout validation](#validate-layout) is performed before actually initializing Terraform unless explicitly indicated against via the `--skip-validation` flag.

### Options
* `--skip-validation`: Skips layout validation.
* `--layers`: Applies command to layers listed in this option. (see more info [here](./layers))

!!! info "Regarding S3 backend keys"
If the S3 backend block is set, and no key was defined, Leverage CLI will try to create a new one autoatically and store it in the `config.tf` file. It will be based on the layer path relative to the account.

---
## `plan`
Expand All @@ -40,7 +43,10 @@ Equivalent to `terraform plan`.

All arguments given are passed as received to Terraform.

Can only be run at **layer** level.
Can only be run at **layer** level if `--layers` is not set, or at **account** or **layers-container-directory** if it is.

### Options
* `--layers`: Applies command to layers listed in this option. (see more info [here](./layers))

---
## `apply`
Expand All @@ -54,7 +60,10 @@ Equivalent to `terraform apply`.

All arguments given are passed as received to Terraform.

Can only be run at **layer** level.
Can only be run at **layer** level if `--layers` is not set, or at **account** or **layers-container-directory** if it is.

### Options
* `--layers`: Applies command to layers listed in this option. (see more info [here](./layers))

---
## `destroy`
Expand All @@ -68,7 +77,10 @@ Equivalent to `terraform destroy`.

All arguments given are passed as received to Terraform.

Can only be run at **layer** level.
Can only be run at **layer** level if `--layers` is not set, or at **account** or **layers-container-directory** if it is.

### Options
* `--layers`: Applies command to layers listed in this option. (see more info [here](./layers))

---
## `output`
Expand All @@ -82,7 +94,10 @@ Equivalent to `terraform output`.

All arguments given are passed as received to Terraform.

Can only be run at **layer** level.
Can only be run at **layer** level if `--layers` is not set, or at **account** or **layers-container-directory** if it is.

### Options
* `--layers`: Applies command to layers listed in this option. (see more info [here](./layers))

---
## `version`
Expand Down
107 changes: 107 additions & 0 deletions docs/user-guide/leverage-cli/reference/terraform/layers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Layers parameter

This parameter can be used with the following Leverage CLI Terraform commands:

* `init`
* `plan`
* `apply`
* `output`
* `destroy`

Value:

| Parameter | Type | Description |
|:-----------|:-------|:--------------------------------------------------|
| `--layers` | string | A comma serparated list of layer's relative paths |

## Common workflow

When using the `--layers` parameter, these commands should be run from `account` or `layers-container-directory` directories.

**Example:**

For this structure:

```
home
├── user
│   └── project
│   └── management
│   ├── global
│   | └── security-base
│   | └── sso
│   └── us-east-1
│   └── terraform-backend
```

...any of the aforementioned commands, combined with `--layers`, can be called from `/home/user/project/management/`, `/home/user/project/management/global/` or `/home/user/project/management/us-east-1/`.

The value for this parameter is a comma separated list of layer's relative paths.

Leverage CLI will iterate through the layer's relative paths, going into each one, executing the command and going back to the original directory.

**Example:**

For this command, from `/home/user/project/management/`:

```bash
leverage tf plan --layers us-east-1/terraform-backend,global/security-base
```

...the Leverage CLI will:

* check each one of the layer's relative paths exists
* go into `us-east-1/terraform-backend` directory
* run the `plan` command
* go back to `/home/user/project/management/`
* go into `global/security-base` directory
* run the `plan` command
* go back to `/home/user/project/management/`

## The `init` case

When running `init` Leverage CLI runs a [validation](../terraform/#validate-layout).

When using the `--layers` option, the validation is run for every layer before the command itself is run.

**Example:**

For this command, from `/home/user/project/management/`:

```bash
leverage tf init --layers us-east-1/terraform-backend,global/security-base
```

...the Leverage CLI will:

* check each one of the layer's relative paths exists
* go into `us-east-1/terraform-backend` directory
* run the `validate-layout` command
* go back to `/home/user/project/management/`
* go into `global/security-base` directory
* run the `validate-layout` command
* go back to `/home/user/project/management/`
* go into `us-east-1/terraform-backend` directory
* run the `init` command
* go back to `/home/user/project/management/`
* go into `global/security-base` directory
* run the `init` command
* go back to `/home/user/project/management/`

This is done this way to prevent truncated executions. Meaning, if any of the validation fails, the user will be able to fix whatever has to be fixed and run the command again as it is.

!!! info "Skipping the validation"
The `--skip-validation` flag still can be used here with `--layers`.

## Terraform parameters and flags

Terraform parameters and flags can still be passed when using the `--layers` parameter.

**Example:**


```bash
leverage tf apply --layers us-east-1/terraform-backend,global/security-base -auto-approve
```
29 changes: 29 additions & 0 deletions docs/user-guide/leverage-cli/reference/tfautomv.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Command: `tfautomv`

!!! info "Regarding Leverage Toolbox versions"
For using this feature Leverage Toolbox versions `1.2.7-0.0.5` and up, or `1.3.5-0.0.1` and up must be used.

The `tfautomv` command is a wrapper for a containerized installation of [tfautomv](https://tfautomv.dev/). It provides the tfautomv executable with specific configuration values required by Leverage.

It transparently handles authentication, whether it is Multi-Factor or via Single Sign-On, on behalf of the user in the commands that require it. SSO Authentication takes precedence over MFA when both are active.

This command can only be run at **layer** level and will not run anywhere else in the project.

---
## `run`

### Usage
``` bash
leverage tfautomv run [arguments]
```

Equivalent to `tfautomv`.

All arguments given are passed as received to tfautomv.

**Example:**

```bash
leverage tfautomv run --show-analysis --dry-run
```

5 changes: 5 additions & 0 deletions docs/user-guide/ref-architecture-aws/workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
6. Run `leverage terraform plan` if you only mean to preview those changes
7. Run `leverage terraform apply` if you want to review and likely apply those changes

!!! info
Please note you can make use of the `--layers` parameter to apply Terraform commands to more than one layer.

For more information see [here](../leverage-cli/reference/terraform/layers.md)

!!! note
If desired, at step **#5** you could submit a PR, allowing you and the rest of the team to
understand and review what changes would be made to your AWS Cloud Architecture components before executing
Expand Down
69 changes: 63 additions & 6 deletions docs/work-with-us/releases/versions-compatibility-matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,69 @@ component by component based on the below presented compatibility matrix table.

## Compatibility Matrix

| Leverage Ref Arch :construction_site: :cloud: version | Leverage Cli | Terraform | Terraform AWS provider | K8s EKS |
|-------------------------------------------------------|--------------|-----------|------------------------|-----------|
| v1.8.1 | v1.7.2 | >= 1.1.9 | 3.27.x, 4.x.y | 1.20-1.22 |
| v1.7.2 | v1.6.2 | >= 1.1.3 | 3.27.x, 4.x.y | 1.17-1.19 |
| ~~v1.3.73~~ | v1.2.0 | 1.0.x | 3.27.x | 1.17 |
| ~~v1.3.25~~ | v1.0.10 | 0.14.x | 3.27.x | 1.17 |
<table>
<tr>
<th>Leverage Ref Arch version</th>
<th>Leverage CLI</th>
<th>Leverage Toolbox<br /><small>image</small><br /><small>version</small></th>
<th>Terraform</th>
<th>Terraform AWS provider</th>
<th>K8s EKS</th>
</tr>
<tr>
<td rowspan="3">v1.11.0</td>
<td rowspan="2">v1.9.x</td>
<td>`binbash/leverage-toolbox`<br /> ==1.3.5-0.0.x</td>
<td>1.3.5</td>
<td>3.27.x, 4.x.y</td>
<td>1.20-1.22</td>
</tr>
<tr>
<td>`binbash/leverage-toolbox`<br /> ==1.2.7-0.1.x</td>
<td>1.2.7</td>
<td>3.27.x, 4.x.y</td>
<td>1.20-1.22</td>
</tr>
<tr>
<td>v1.8.x</td>
<td>`binbash/leverage-toolbox`<br /> ==1.2.7-0.0.x</td>
<td>1.2.7</td>
<td>3.27.x, 4.x.y</td>
<td>1.20-1.22</td>
</tr>
<tr>
<td>v1.8.1</td>
<td>v1.7.2</td>
<td>`binbash/terraform-awscli-slim`<br /> >=1.1.9</td>
<td>1.1.9</td>
<td>3.27.x, 4.x.y</td>
<td>1.20-1.22</td>
</tr>
<tr>
<td>v1.7.2</td>
<td>v1.6.2</td>
<td>`binbash/terraform-awscli-slim`<br /> >=1.1.3</td>
<td>1.1.3</td>
<td>3.27.x, 4.x.y</td>
<td>1.17-1.19</td>
</tr>
<tr>
<td><del>v1.3.73</del></td>
<td>v1.2.0</td>
<td>`binbash/terraform-awscli-slim`<br /> >=1.0.x</td>
<td>1.0.x</td>
<td>3.27.x</td>
<td>1.17</td>
</tr>
<tr>
<td><del>v1.3.25</del></td>
<td>v1.0.10</td>
<td>`binbash/terraform-awscli-slim`<br /> >=0.14.x</td>
<td>0.14.x</td>
<td>3.27.x</td>
<td>1.17</td>
</tr>
</table>

Releases which are ~~crossed out~~ _should_ work, but are unlikely to get security or other fixes.
We suggest they should be upgraded soon.
Expand Down
5 changes: 4 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,10 @@ nav:
- project: "user-guide/leverage-cli/reference/project.md"
- credentials: "user-guide/leverage-cli/reference/credentials.md"
- aws: "user-guide/leverage-cli/reference/aws.md"
- terraform: "user-guide/leverage-cli/reference/terraform.md"
- terraform:
- commands: "user-guide/leverage-cli/reference/terraform.md"
- layers: "user-guide/leverage-cli/reference/terraform/layers.md"
- tfautomv: "user-guide/leverage-cli/reference/tfautomv.md"
- run: "user-guide/leverage-cli/reference/run.md"
- Custom tasks: "user-guide/leverage-cli/tasks.md"
- Shell environment: "user-guide/leverage-cli/shell.md"
Expand Down

0 comments on commit b0d3505

Please sign in to comment.