Skip to content

Commit

Permalink
use APP_CONFIGURATION_NAME
Browse files Browse the repository at this point in the history
  • Loading branch information
rdeveen committed Mar 25, 2024
1 parent 1cbd5e5 commit ec3746e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 17 deletions.
1 change: 1 addition & 0 deletions .github/workflows/02-deploy-sap-workload-zone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,4 @@ jobs:
workload_environment: ${{ inputs.workload_environment }}
workload_zone_folder: ${{ inputs.workload_zone }}
workload_zone_configuration_file: ${{ inputs.workload_zone }}.tfvars
APP_CONFIGURATION_NAME: ${{ vars.APP_CONFIGURATION_NAME }}
Original file line number Diff line number Diff line change
Expand Up @@ -188,41 +188,36 @@ echo -e "$green--- Read parameter values ---${resetformatting}"

#if [ "true" == ${inherit} ]; then
var=$(get_value_with_key "Deployer_State_FileName")

if [ -z ${var} ]; then
deployer_tfstate_key=$(config_value_with_key "deployer_tfstate_key")
echo "Deployer State File: " $deployer_tfstate_key
else
deployer_tfstate_key=${var}
echo "Deployer State File: " $deployer_tfstate_key
fi
echo "Deployer State File: " $deployer_tfstate_key

var=$(get_value_with_key "Deployer_Key_Vault")
if [ -z ${var} ]; then
key_vault=$(config_value_with_key "keyvault")
echo "Deployer Key Vault: " ${key_vault}
else
key_vault=${var}
echo "Deployer Key Vault: " ${key_vault}
fi
echo "Deployer Key Vault: " ${key_vault}

var=$(get_value_with_key "Terraform_Remote_Storage_Account_Name")
if [ -z ${var} ]; then
REMOTE_STATE_SA=$(config_value_with_key "REMOTE_STATE_SA")
echo "Terraform state file storage account: " $REMOTE_STATE_SA
else
REMOTE_STATE_SA=${var}
echo "Terraform state file storage account: " $REMOTE_STATE_SA
fi
echo "Terraform state file storage account: " $REMOTE_STATE_SA

var=$(get_value_with_key "Terraform_Remote_Storage_Subscription")
if [ -z ${var} ]; then
STATE_SUBSCRIPTION=$(config_value_with_key "STATE_SUBSCRIPTION")
echo "Terraform state file subscription: " $STATE_SUBSCRIPTION
else
STATE_SUBSCRIPTION=${var}
echo "Terraform state file subscription: " $STATE_SUBSCRIPTION
fi
echo "Terraform state file subscription: " $STATE_SUBSCRIPTION

var=$(get_value_with_key "ARM_SUBSCRIPTION_ID")
if [ -z ${var} ]; then
Expand Down
16 changes: 8 additions & 8 deletions deploy/automation/shared_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ esac
function __appconfig_get_value_with_key() {
key=$1

var=$(az appconfig kv show -n ${appconfig_name} --key ${key} --label ${variable_group} --query value)
var=$(az appconfig kv show -n ${APP_CONFIGURATION_NAME} --key ${key} --label ${variable_group} --query value)

echo $var
}
Expand All @@ -57,16 +57,16 @@ function __appconfig_set_value_with_key() {
key=$1
value=$2

echo "Saving value for key in ${appconfig_name}: ${key}"
var=$(az appconfig kv set -n ${appconfig_name} --key ${key} --label ${variable_group} --value $value --content-type text/plain --yes)
echo "Saving value for key in ${APP_CONFIGURATION_NAME}: ${key}"
var=$(az appconfig kv set -n ${APP_CONFIGURATION_NAME} --key ${key} --label ${variable_group} --value $value --content-type text/plain --yes)

echo $var
}

function __appconfig_get_secret_with_key() {
key=$1

var=$(az appconfig kv show -n ${appconfig_name} --key ${key} --label ${variable_group} --query value --secret)
var=$(az appconfig kv show -n ${APP_CONFIGURATION_NAME} --key ${key} --label ${variable_group} --query value --secret)

echo $var
}
Expand All @@ -78,7 +78,7 @@ function get_value_with_key() {
exit_error "Cannot get value with an empty key" 1
fi

if [[ -v appconfig_name ]]; then
if [[ -v APP_CONFIGURATION_NAME ]]; then
value=$(__appconfig_get_value_with_key $key)
else
value=$(__get_value_with_key $key)
Expand All @@ -95,7 +95,7 @@ function set_value_with_key() {
exit_error "Cannot set value with an empty key" 1
fi

if [[ -v appconfig_name ]]; then
if [[ -v APP_CONFIGURATION_NAME ]]; then
__appconfig_set_value_with_key $key $value
else
__set_value_with_key $key $value
Expand All @@ -109,7 +109,7 @@ function get_secret_with_key() {
exit_error "Cannot get secret with an empty key" 1
fi

if [[ -v appconfig_name ]]; then
if [[ -v APP_CONFIGURATION_NAME ]]; then
value=$(__appconfig_get_secret_with_key $key)
else
value=$(__set_secret_with_key $key)
Expand All @@ -126,7 +126,7 @@ function set_secret_with_key() {
exit_error "Cannot set secret with an empty key" 1
fi

if [[ -v appconfig_name ]]; then
if [[ -v APP_CONFIGURATION_NAME ]]; then
__appconfig_set_secret_with_key $key $value
else
__set_secret_with_key $key $value
Expand Down

0 comments on commit ec3746e

Please sign in to comment.