From c9e5d577cb1eeac2337f99c19c40fc8ebd2a2622 Mon Sep 17 00:00:00 2001 From: Glenn Musa <4622125+glennmusa@users.noreply.github.com> Date: Thu, 18 Mar 2021 13:07:31 -0400 Subject: [PATCH] move scripts to src/scripts (#87) --- README.md | 18 +++++++++--------- build/apply_tf.sh | 2 +- build/destroy_tf.sh | 2 +- {scripts => src/scripts}/apply_terraform.sh | 0 .../scripts}/config/config_create.sh | 0 .../scripts}/config/config_validate.sh | 0 .../scripts}/config/generate_names.sh | 0 .../scripts}/config/generate_vars.sh | 0 .../scripts}/config/get_sp_identity.sh | 0 .../scripts}/config/mlz_config_create.sh | 0 {scripts => src/scripts}/destroy_terraform.sh | 0 {scripts => src/scripts}/init_terraform.sh | 0 {scripts => src/scripts}/mlz_tf_setup.sh | 2 +- .../scripts}/security-center/configure_asc.sh | 0 .../scripts}/security-center/generate_names.sh | 0 {scripts => src/scripts}/util/checkforazcli.sh | 0 {scripts => src/scripts}/util/checkforfile.sh | 0 .../scripts}/util/checkforterraform.sh | 0 18 files changed, 12 insertions(+), 12 deletions(-) rename {scripts => src/scripts}/apply_terraform.sh (100%) rename {scripts => src/scripts}/config/config_create.sh (100%) rename {scripts => src/scripts}/config/config_validate.sh (100%) rename {scripts => src/scripts}/config/generate_names.sh (100%) rename {scripts => src/scripts}/config/generate_vars.sh (100%) rename {scripts => src/scripts}/config/get_sp_identity.sh (100%) rename {scripts => src/scripts}/config/mlz_config_create.sh (100%) rename {scripts => src/scripts}/destroy_terraform.sh (100%) rename {scripts => src/scripts}/init_terraform.sh (100%) rename {scripts => src/scripts}/mlz_tf_setup.sh (95%) rename {scripts => src/scripts}/security-center/configure_asc.sh (100%) rename {scripts => src/scripts}/security-center/generate_names.sh (100%) rename {scripts => src/scripts}/util/checkforazcli.sh (100%) rename {scripts => src/scripts}/util/checkforfile.sh (100%) rename {scripts => src/scripts}/util/checkforterraform.sh (100%) diff --git a/README.md b/README.md index 778caa1c7..8d442b151 100644 --- a/README.md +++ b/README.md @@ -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 @@ -48,9 +48,9 @@ The MLZ deployment architecture uses a single Service Principal whose credential ```bash # usage mlz_tf_setup.sh: - 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 @@ -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: @@ -86,7 +86,7 @@ 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 ``` @@ -94,19 +94,19 @@ scripts/apply_terraform.sh \ 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 ``` diff --git a/build/apply_tf.sh b/build/apply_tf.sh index e598604b8..553061de0 100755 --- a/build/apply_tf.sh +++ b/build/apply_tf.sh @@ -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}" diff --git a/build/destroy_tf.sh b/build/destroy_tf.sh index a08eddbb6..96cf1515f 100755 --- a/build/destroy_tf.sh +++ b/build/destroy_tf.sh @@ -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}" diff --git a/scripts/apply_terraform.sh b/src/scripts/apply_terraform.sh similarity index 100% rename from scripts/apply_terraform.sh rename to src/scripts/apply_terraform.sh diff --git a/scripts/config/config_create.sh b/src/scripts/config/config_create.sh similarity index 100% rename from scripts/config/config_create.sh rename to src/scripts/config/config_create.sh diff --git a/scripts/config/config_validate.sh b/src/scripts/config/config_validate.sh similarity index 100% rename from scripts/config/config_validate.sh rename to src/scripts/config/config_validate.sh diff --git a/scripts/config/generate_names.sh b/src/scripts/config/generate_names.sh similarity index 100% rename from scripts/config/generate_names.sh rename to src/scripts/config/generate_names.sh diff --git a/scripts/config/generate_vars.sh b/src/scripts/config/generate_vars.sh similarity index 100% rename from scripts/config/generate_vars.sh rename to src/scripts/config/generate_vars.sh diff --git a/scripts/config/get_sp_identity.sh b/src/scripts/config/get_sp_identity.sh similarity index 100% rename from scripts/config/get_sp_identity.sh rename to src/scripts/config/get_sp_identity.sh diff --git a/scripts/config/mlz_config_create.sh b/src/scripts/config/mlz_config_create.sh similarity index 100% rename from scripts/config/mlz_config_create.sh rename to src/scripts/config/mlz_config_create.sh diff --git a/scripts/destroy_terraform.sh b/src/scripts/destroy_terraform.sh similarity index 100% rename from scripts/destroy_terraform.sh rename to src/scripts/destroy_terraform.sh diff --git a/scripts/init_terraform.sh b/src/scripts/init_terraform.sh similarity index 100% rename from scripts/init_terraform.sh rename to src/scripts/init_terraform.sh diff --git a/scripts/mlz_tf_setup.sh b/src/scripts/mlz_tf_setup.sh similarity index 95% rename from scripts/mlz_tf_setup.sh rename to src/scripts/mlz_tf_setup.sh index d2017a382..2f8da2a02 100755 --- a/scripts/mlz_tf_setup.sh +++ b/src/scripts/mlz_tf_setup.sh @@ -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() { diff --git a/scripts/security-center/configure_asc.sh b/src/scripts/security-center/configure_asc.sh similarity index 100% rename from scripts/security-center/configure_asc.sh rename to src/scripts/security-center/configure_asc.sh diff --git a/scripts/security-center/generate_names.sh b/src/scripts/security-center/generate_names.sh similarity index 100% rename from scripts/security-center/generate_names.sh rename to src/scripts/security-center/generate_names.sh diff --git a/scripts/util/checkforazcli.sh b/src/scripts/util/checkforazcli.sh similarity index 100% rename from scripts/util/checkforazcli.sh rename to src/scripts/util/checkforazcli.sh diff --git a/scripts/util/checkforfile.sh b/src/scripts/util/checkforfile.sh similarity index 100% rename from scripts/util/checkforfile.sh rename to src/scripts/util/checkforfile.sh diff --git a/scripts/util/checkforterraform.sh b/src/scripts/util/checkforterraform.sh similarity index 100% rename from scripts/util/checkforterraform.sh rename to src/scripts/util/checkforterraform.sh