Skip to content

Commit

Permalink
feat: add Azure China region support
Browse files Browse the repository at this point in the history
  • Loading branch information
jmolnar-zscaler committed Nov 8, 2023
1 parent 0a2335f commit 7ac8c1e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
16 changes: 12 additions & 4 deletions examples/zsec
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ elif [[ ! -d $dir ]]; then
exit 1
fi

az_regions=["westus","West US","westus2","West US 2","eastus","East US","centralus","Central US","centraluseuap","Central US EUAP","southcentralus","South Central US","northcentralus","North Central US","westcentralus","West Central US","eastus2","East US 2","eastus2euap","East US 2 EUAP","brazilsouth","Brazil South","northeurope","North Europe","westeurope","West Europe","eastasia","East Asia","southeastasia","Southeast Asia","japanwest","Japan West","japaneast","Japan East","koreacentral","Korea Central","koreasouth","Korea South","southindia","South India","westindia","West India","centralindia","Central India","australiaeast","Australia East","australiasoutheast","Australia Southeast","canadacentral","Canada Central","canadaeast","Canada East","uksouth","UK South","ukwest","UK West","francecentral","France Central","francesouth","France South","australiacentral","Australia Central","australiacentral2","Australia Central 2","uaecentral","UAE Central","uaenorth","UAE North","southafricanorth"," South Africa North","southafricawest","South Africa West","switzerlandnorth","Switzerland North","switzerlandwest","Switzerland West","germanynorth","Germany North","germanywestcentral","Germany West Central","norwayeast","Norway East","norwaywest","Norway West","brazilsoutheast","Brazil Southeast","westus3","West US 3","swedencentral","Sweden Central","swedensouth","Sweden South"]
az_regions=["westus","West US","westus2","West US 2","eastus","East US","centralus","Central US","centraluseuap","Central US EUAP","southcentralus","South Central US","northcentralus","North Central US","westcentralus","West Central US","eastus2","East US 2","eastus2euap","East US 2 EUAP","brazilsouth","Brazil South","northeurope","North Europe","westeurope","West Europe","eastasia","East Asia","southeastasia","Southeast Asia","japanwest","Japan West","japaneast","Japan East","koreacentral","Korea Central","koreasouth","Korea South","southindia","South India","westindia","West India","centralindia","Central India","australiaeast","Australia East","australiasoutheast","Australia Southeast","canadacentral","Canada Central","canadaeast","Canada East","uksouth","UK South","ukwest","UK West","francecentral","France Central","francesouth","France South","australiacentral","Australia Central","australiacentral2","Australia Central 2","uaecentral","UAE Central","uaenorth","UAE North","southafricanorth"," South Africa North","southafricawest","South Africa West","switzerlandnorth","Switzerland North","switzerlandwest","Switzerland West","germanynorth","Germany North","germanywestcentral","Germany West Central","norwayeast","Norway East","norwaywest","Norway West","brazilsoutheast","Brazil Southeast","westus3","West US 3","swedencentral","Sweden Central","swedensouth","Sweden South","chinaeast","China East","ChinaEast","chinaeast2","China East 2","ChinaEast2","chinanorth","China North","ChinaNorth","chinanorth2","China North 2","ChinaNorth2","chinanorth3","China North 3","ChinaNorth3"]
# if .zsecrc is not present we'll assume that Azure env was never set
if [[ $dtype == "base" && ! -e ./.zsecrc ]]; then
echo "Checking Azure Environment Variables..."
Expand All @@ -129,7 +129,11 @@ if [[ $dtype == "base" && ! -e ./.zsecrc ]]; then
echo "export ARM_CLIENT_SECRET=${azure_client_secret}" >> .zsecrc
read -r -p "Enter Azure Region (e.g. westus2): " azure_location
if [[ ${az_regions[*]} =~ $azure_location ]]; then
echo "export TF_VAR_arm_location=${azure_location}" >> .zsecrc
echo "export TF_VAR_arm_location='$azure_location'" >> .zsecrc
if [[ ${azure_location,,} = "china"* ]]; then
echo "Azure China region detected. Setting ARM_ENVIRONMENT..."
echo "export ARM_ENVIRONMENT=china" >> .zsecrc
fi
else
echo "Invalid Azure region name entered."
echo "Delete .zsecrc file and re-run zsec up..."
Expand Down Expand Up @@ -196,7 +200,11 @@ if [[ ! -e ./.zsecrc ]]; then
echo "export ARM_CLIENT_SECRET=${azure_client_secret}" >> .zsecrc
read -r -p "Enter Azure Region (e.g. westus2): " azure_location
if [[ ${az_regions[*]} =~ $azure_location ]]; then
echo "export TF_VAR_arm_location='${azure_location}'" >> .zsecrc
echo "export TF_VAR_arm_location='$azure_location'" >> .zsecrc
if [[ ${azure_location,,} = "china"* ]]; then
echo "Azure China region detected. Setting ARM_ENVIRONMENT..."
echo "export ARM_ENVIRONMENT=china" >> .zsecrc
fi
else
echo "Invalid Azure region name entered."
echo "Delete .zsecrc file and re-run zsec up..."
Expand Down Expand Up @@ -402,7 +410,7 @@ elif [[ "$dtype" == "base_1cc" ]]; then
echo "${dtype} will deploy one Cloud Connector in ${azure_location}"
fi

az_supported_regions=["australiaeast","Australia East","brazilsouth","Brazil South","canadacentral","Canada Central","centralindia","Central India","centralus","Central US","eastasia","East Asia","eastus","East US","francecentral","France Central","germanywestcentral","Germany West Central","japaneast","Japan East","koreacentral","Korea Central","northeurope","North Europe","norwayeast","Norway East","southafricanorth","South Africa North","southcentralus","South Central US","southeastasia","Southeast Asia","swedencentral","Sweden Central","uksouth","UK South","westeurope","West Europe","westus2","West US 2","westus3","West US 3"]
az_supported_regions=["australiaeast","Australia East","brazilsouth","Brazil South","canadacentral","Canada Central","centralindia","Central India","centralus","Central US","eastasia","East Asia","eastus","East US","francecentral","France Central","germanywestcentral","Germany West Central","japaneast","Japan East","koreacentral","Korea Central","northeurope","North Europe","norwayeast","Norway East","southafricanorth","South Africa North","southcentralus","South Central US","southeastasia","Southeast Asia","swedencentral","Sweden Central","uksouth","UK South","westeurope","West Europe","westus2","West US 2","westus3","West US 3","chinanorth3","China North 3","ChinaNorth3"]
if [[ ${az_supported_regions[*]} =~ $azure_location ]]; then
echo "Azure region ${azure_location} supports Zones..."
zones_enabled_default=no
Expand Down
2 changes: 1 addition & 1 deletion modules/terraform-zscc-ccvm-azure/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ variable "backend_address_pool" {

# Validation to determine if Azure Region selected supports availabilty zones if desired
locals {
az_supported_regions = ["australiaeast", "Australia East", "brazilsouth", "Brazil South", "canadacentral", "Canada Central", "centralindia", "Central India", "centralus", "Central US", "eastasia", "East Asia", "eastus", "East US", "francecentral", "France Central", "germanywestcentral", "Germany West Central", "japaneast", "Japan East", "koreacentral", "Korea Central", "northeurope", "North Europe", "norwayeast", "Norway East", "southafricanorth", "South Africa North", "southcentralus", "South Central US", "southeastasia", "Southeast Asia", "swedencentral", "Sweden Central", "uksouth", "UK South", "westeurope", "West Europe", "westus2", "West US 2", "westus3", "West US 3"]
az_supported_regions = ["australiaeast", "Australia East", "brazilsouth", "Brazil South", "canadacentral", "Canada Central", "centralindia", "Central India", "centralus", "Central US", "eastasia", "East Asia", "eastus", "East US", "francecentral", "France Central", "germanywestcentral", "Germany West Central", "japaneast", "Japan East", "koreacentral", "Korea Central", "northeurope", "North Europe", "norwayeast", "Norway East", "southafricanorth", "South Africa North", "southcentralus", "South Central US", "southeastasia", "Southeast Asia", "swedencentral", "Sweden Central", "uksouth", "UK South", "westeurope", "West Europe", "westus2", "West US 2", "westus3", "West US 3", "chinanorth3", "China North 3", "ChinaNorth3"]
zones_supported = (
contains(local.az_supported_regions, var.location) && var.zones_enabled == true
)
Expand Down
2 changes: 1 addition & 1 deletion modules/terraform-zscc-lb-azure/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ variable "load_distribution" {

# Validation to determine if Azure Region selected supports availabilty zones if desired
locals {
az_supported_regions = ["australiaeast", "Australia East", "brazilsouth", "Brazil South", "canadacentral", "Canada Central", "centralindia", "Central India", "centralus", "Central US", "eastasia", "East Asia", "eastus", "East US", "francecentral", "France Central", "germanywestcentral", "Germany West Central", "japaneast", "Japan East", "koreacentral", "Korea Central", "northeurope", "North Europe", "norwayeast", "Norway East", "southafricanorth", "South Africa North", "southcentralus", "South Central US", "southeastasia", "Southeast Asia", "swedencentral", "Sweden Central", "uksouth", "UK South", "westeurope", "West Europe", "westus2", "West US 2", "westus3", "West US 3"]
az_supported_regions = ["australiaeast", "Australia East", "brazilsouth", "Brazil South", "canadacentral", "Canada Central", "centralindia", "Central India", "centralus", "Central US", "eastasia", "East Asia", "eastus", "East US", "francecentral", "France Central", "germanywestcentral", "Germany West Central", "japaneast", "Japan East", "koreacentral", "Korea Central", "northeurope", "North Europe", "norwayeast", "Norway East", "southafricanorth", "South Africa North", "southcentralus", "South Central US", "southeastasia", "Southeast Asia", "swedencentral", "Sweden Central", "uksouth", "UK South", "westeurope", "West Europe", "westus2", "West US 2", "westus3", "West US 3", "chinanorth3", "China North 3", "ChinaNorth3"]
zones_supported = (
contains(local.az_supported_regions, var.location) && var.zones_enabled == true
)
Expand Down
2 changes: 1 addition & 1 deletion modules/terraform-zscc-network-azure/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ variable "private_dns_subnet" {

# Validation to determine if Azure Region selected supports availabilty zones if desired
locals {
az_supported_regions = ["australiaeast", "Australia East", "brazilsouth", "Brazil South", "canadacentral", "Canada Central", "centralindia", "Central India", "centralus", "Central US", "eastasia", "East Asia", "eastus", "East US", "francecentral", "France Central", "germanywestcentral", "Germany West Central", "japaneast", "Japan East", "koreacentral", "Korea Central", "northeurope", "North Europe", "norwayeast", "Norway East", "southafricanorth", "South Africa North", "southcentralus", "South Central US", "southeastasia", "Southeast Asia", "swedencentral", "Sweden Central", "uksouth", "UK South", "westeurope", "West Europe", "westus2", "West US 2", "westus3", "West US 3"]
az_supported_regions = ["australiaeast", "Australia East", "brazilsouth", "Brazil South", "canadacentral", "Canada Central", "centralindia", "Central India", "centralus", "Central US", "eastasia", "East Asia", "eastus", "East US", "francecentral", "France Central", "germanywestcentral", "Germany West Central", "japaneast", "Japan East", "koreacentral", "Korea Central", "northeurope", "North Europe", "norwayeast", "Norway East", "southafricanorth", "South Africa North", "southcentralus", "South Central US", "southeastasia", "Southeast Asia", "swedencentral", "Sweden Central", "uksouth", "UK South", "westeurope", "West Europe", "westus2", "West US 2", "westus3", "West US 3", "chinanorth3", "China North 3", "ChinaNorth3"]
zones_supported = (
contains(local.az_supported_regions, var.location) && var.zones_enabled == true
)
Expand Down

0 comments on commit 7ac8c1e

Please sign in to comment.