diff --git a/aws/quickstart.sh b/aws/quickstart.sh index 5b40aa5..21009fa 100644 --- a/aws/quickstart.sh +++ b/aws/quickstart.sh @@ -19,7 +19,7 @@ export TF_VAR_env_prefix="${2:-""}" export ACCOUNT_ID="${3:-""}" export CDP_REGION="${4:-"us-west-1"}" export TF_VAR_deployment_template="${5:-"semi-private"}" -export TF_VAR_ingress_extra_cidrs_and_ports="${6:-"{ cidrs = [\"0.0.0.0/0\"], ports = [443, 22] }"}" +export TF_VAR_ingress_extra_cidrs_and_ports="${6:-\"{ cidrs = [\"0.0.0.0/0\"], ports = [443, 22] }\"}" export TF_VAR_env_tags='{"deploy_tool": "express-tf", "env_prefix": "'"$2"'"}' export TF_VAR_create_vpc_endpoints="false" export TF_VAR_environment_async_creation="true" @@ -69,8 +69,10 @@ cd cdp-tf-quickstarts/aws pip install cdpcli config_file="${HOME}/.cdp/config" -region_config="cdp_region = ${CDP_REGION}" -echo "$region_config" >> "$config_file" +cat < $config_file +[default] +cdp_region = ${CDP_REGION} +EOF cdp login --account-id "${ACCOUNT_ID}" --use-device-code diff --git a/azure/main.tf b/azure/main.tf index 31867cd..239591b 100644 --- a/azure/main.tf +++ b/azure/main.tf @@ -92,7 +92,7 @@ module "cdp_deploy" { datalake_async_creation = var.datalake_async_creation # From pre-reqs module output - azure_subscription_id = module.cdp_azure_prereqs.azure_subscription_id + azure_subscription_id = var.azure_subscription_id == null ? module.cdp_azure_prereqs.azure_subscription_id : var.azure_subscription_id azure_tenant_id = module.cdp_azure_prereqs.azure_tenant_id azure_resource_group_name = module.cdp_azure_prereqs.azure_resource_group_name diff --git a/azure/quickstart.sh b/azure/quickstart.sh index ca58e03..e0eb459 100644 --- a/azure/quickstart.sh +++ b/azure/quickstart.sh @@ -19,11 +19,12 @@ export TF_VAR_env_prefix="${2:-""}" export ACCOUNT_ID="${3:-""}" export CDP_REGION="${4:-"us-west-1"}" export TF_VAR_deployment_template="${5:-"semi-private"}" -export TF_VAR_ingress_extra_cidrs_and_ports="${6:-"{ cidrs = [\"0.0.0.0/0\"], ports = [443, 22] }"}" +export TF_VAR_ingress_extra_cidrs_and_ports="${6:-\"{ cidrs = [\"0.0.0.0/0\"], ports = [443, 22] }\"}" export TF_VAR_env_tags='{"deploy_tool": "express-tf", "env_prefix": "'"$2"'"}' export TF_VAR_environment_async_creation="true" export TF_VAR_datalake_async_creation="true" export TF_VAR_datalake_scale="LIGHT_DUTY" +export TF_VAR_azure_subscription_id="$(az account show --query id --output tsv)" # Save TF variables to file output_file="variables.sh" @@ -38,6 +39,7 @@ export TF_VAR_environment_async_creation="${TF_VAR_environment_async_creation}" export TF_VAR_datalake_async_creation="${TF_VAR_datalake_async_creation}" export TF_VAR_ingress_extra_cidrs_and_ports="${TF_VAR_ingress_extra_cidrs_and_ports}" export TF_VAR_datalake_scale="${TF_VAR_datalake_scale}" +export TF_VAR_azure_subscription_id="${TF_VAR_azure_subscription_id}" EOF destroy_file="destroy.sh" @@ -62,8 +64,10 @@ cd cdp-tf-quickstarts/azure pip install cdpcli config_file="${HOME}/.cdp/config" -region_config="cdp_region = ${CDP_REGION}" -echo "$region_config" >> "$config_file" +cat < $config_file +[default] +cdp_region = ${CDP_REGION} +EOF cdp login --account-id "${ACCOUNT_ID}" --use-device-code diff --git a/azure/variables.tf b/azure/variables.tf index 79de355..6fd9f92 100644 --- a/azure/variables.tf +++ b/azure/variables.tf @@ -105,6 +105,14 @@ variable "datalake_recipes" { default = null } +variable "azure_subscription_id" { + type = string + + description = "The subscription where the environment should be deployed to" + + default = null +} + # ------- Network Resources ------- variable "ingress_extra_cidrs_and_ports" { type = object({ diff --git a/gcp/quickstart.sh b/gcp/quickstart.sh index 6d377a3..00ba1b7 100644 --- a/gcp/quickstart.sh +++ b/gcp/quickstart.sh @@ -20,7 +20,7 @@ export TF_VAR_env_prefix="${3:-""}" export ACCOUNT_ID="${4:-""}" export CDP_REGION="${5:-"us-west-1"}" export TF_VAR_deployment_template="${6:-"semi-private"}" -export TF_VAR_ingress_extra_cidrs_and_ports="${7:-"{ cidrs = [\"0.0.0.0/0\"], ports = [443, 22] }"}" +export TF_VAR_ingress_extra_cidrs_and_ports="${6:-\"{ cidrs = [\"0.0.0.0/0\"], ports = [443, 22] }\"}" export TF_VAR_env_tags='{"deploy_tool": "express-tf", "env_prefix": "'"$2"'"}' export TF_VAR_environment_async_creation="true" export TF_VAR_datalake_async_creation="true" @@ -64,8 +64,10 @@ cd cdp-tf-quickstarts/gcp pip install cdpcli config_file="${HOME}/.cdp/config" -region_config="cdp_region = ${CDP_REGION}" -echo "$region_config" >> "$config_file" +cat < $config_file +[default] +cdp_region = ${CDP_REGION} +EOF cdp login --account-id "${ACCOUNT_ID}" --use-device-code