Skip to content

Commit

Permalink
move scripts to src/scripts (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
glennmusa committed Mar 18, 2021
1 parent cd5d2aa commit 397f56a
Show file tree
Hide file tree
Showing 18 changed files with 12 additions and 12 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ The MLZ deployment architecture uses a single Service Principal whose credential
mlz_config_location="eastus"
```

1. Run `mlz_tf_setup.sh` at [scripts/mlz_tf_setup.sh](scripts/mlz_tf_setup.sh) to create:
1. Run `mlz_tf_setup.sh` at [src/scripts/mlz_tf_setup.sh](src/scripts/mlz_tf_setup.sh) to create:

- A config Resource Group to store the Key Vault
- Resource Groups for each tier to store the Terraform state Storage Account
Expand All @@ -48,9 +48,9 @@ The MLZ deployment architecture uses a single Service Principal whose credential
```bash
# usage mlz_tf_setup.sh: <mlz_tf_cfg.var path>
chmod u+x scripts/mlz_tf_setup.sh
chmod u+x src/scripts/mlz_tf_setup.sh
scripts/mlz_tf_setup.sh src/core/mlz_tf_cfg.var
src/scripts/mlz_tf_setup.sh src/core/mlz_tf_cfg.var
```
### Set Terraform Configuration Variables
Expand All @@ -73,9 +73,9 @@ location="eastus" # the value used by Terraform in src/core/globals.tfvars
### Deploy Terraform Configuration
You can use `apply_terraform.sh` at [scripts/apply_terraform.sh](scripts/apply_terraform.sh) to both initialize Terraform and apply a Terraform configuration based on the backend environment variables and Terraform variables you've setup in previous steps.
You can use `apply_terraform.sh` at [src/scripts/apply_terraform.sh](src/scripts/apply_terraform.sh) to both initialize Terraform and apply a Terraform configuration based on the backend environment variables and Terraform variables you've setup in previous steps.

The script `destroy_terraform.sh` at [scripts/destroy_terraform.sh](scripts/destroy_terraform.sh) is helpful during testing. This script is exactly like the
The script `destroy_terraform.sh` at [src/scripts/destroy_terraform.sh](src/scripts/destroy_terraform.sh) is helpful during testing. This script is exactly like the
`apply_terraform.sh` except it destroys resources defined in the target state file

`apply_terraform.sh` and `destroy_terraform.sh` take two arguments:
Expand All @@ -86,27 +86,27 @@ The script `destroy_terraform.sh` at [scripts/destroy_terraform.sh](scripts/dest
For example, from the root of this repository, you could apply Tier 0 with a command like:

```bash
scripts/apply_terraform.sh \
src/scripts/apply_terraform.sh \
src/core/globals.tfvars \
src/core/tier-0
```

To apply Tier 1, you could then change the target directory:

```bash
scripts/apply_terraform.sh \
src/scripts/apply_terraform.sh \
src/core/globals.tfvars \
src/core/tier-1
```

Repeating this same pattern, for whatever configuration you wanted to apply and reuse in some automated pipeline.

Use `init_terraform.sh` at [scripts/init_terraform.sh](scripts/init_terraform.sh) to perform just an initialization of the Terraform environment
Use `init_terraform.sh` at [src/scripts/init_terraform.sh](src/scripts/init_terraform.sh) to perform just an initialization of the Terraform environment

To initialize Terraform for Tier 1, you could then change the target directory:

```bash
scripts/init_terraform.sh \
src/scripts/init_terraform.sh \
src/core/tier-1
```

Expand Down
2 changes: 1 addition & 1 deletion build/apply_tf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ tier2_vars=$6

# reference paths
core_path=$(realpath ../src/core/)
scripts_path=$(realpath ../scripts/)
scripts_path=$(realpath ../src/scripts/)

# source vars from mlz_config
. "${mlz_config}"
Expand Down
2 changes: 1 addition & 1 deletion build/destroy_tf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ tier2_vars=$6

# reference paths
core_path=$(realpath ../src/core/)
scripts_path=$(realpath ../scripts/)
scripts_path=$(realpath ../src/scripts/)

# source vars from mlz_config
. "${mlz_config}"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion scripts/mlz_tf_setup.sh → src/scripts/mlz_tf_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ mlz_tf_cfg=$(realpath "${1}")
. "${mlz_tf_cfg}"

# Core terraform modules path
core_path="$(dirname "$(dirname "$(realpath "${BASH_SOURCE[0]}")")")/src/core"
core_path="$(dirname "$(realpath "${BASH_SOURCE%/*}")")/core"

# Create config resources given a subscription ID and terraform configuration folder path
create_tf_config() {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 397f56a

Please sign in to comment.