Skip to content

Commit

Permalink
Update to deal with scenario where TRE_ID is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
jonnyry committed Jan 8, 2025
1 parent dcb0b8f commit 135be76
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 8 deletions.
18 changes: 14 additions & 4 deletions devops/scripts/kv_add_network_exception.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,25 @@ function main() {
set -o errexit
set -o pipefail

# parse params/set up inputs
# attempt to determine our tre id
#
if [[ -z "$TRE_ID" ]]; then
local TRE_ID_LOCAL="${TRE_ID:-}"

if [[ -z "$TRE_ID_LOCAL" ]]; then
if [[ "${core_tre_rg:-}" == rg-* ]]; then # TRE_ID may not be available when called from destroy_env_no_terraform.sh
TRE_ID_LOCAL="${core_tre_rg#rg-}"
fi
fi

if [[ -z "$TRE_ID_LOCAL" ]]; then
echo -e "Could not add keyvault deployment network exception: TRE_ID is not set\nExiting...\n"
exit 1
fi

local RG_NAME="rg-${TRE_ID}"
local KV_NAME="kv-${TRE_ID}"
# set up variables
#
local RG_NAME="rg-${TRE_ID_LOCAL}"
local KV_NAME="kv-${TRE_ID_LOCAL}"
local MY_IP="${PUBLIC_DEPLOYMENT_IP_ADDRESS:-}"

if [[ -z "$MY_IP" ]]; then
Expand Down
18 changes: 14 additions & 4 deletions devops/scripts/kv_remove_network_exception.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,25 @@ function main() {
set -o errexit
set -o pipefail

# parse params/set up inputs
# attempt to determine our tre id
#
if [[ -z "$TRE_ID" ]]; then
local TRE_ID_LOCAL="${TRE_ID:-}"

if [[ -z "$TRE_ID_LOCAL" ]]; then
if [[ "${core_tre_rg:-}" == rg-* ]]; then # TRE_ID may not be available when called from destroy_env_no_terraform.sh
TRE_ID_LOCAL="${core_tre_rg#rg-}"
fi
fi

if [[ -z "$TRE_ID_LOCAL" ]]; then
echo -e "Could not remove keyvault deployment network exception: TRE_ID is not set\nExiting...\n"
exit 1
fi

local RG_NAME="rg-${TRE_ID}"
local KV_NAME="kv-${TRE_ID}"
# set up variables
#
local RG_NAME="rg-${TRE_ID_LOCAL}"
local KV_NAME="kv-${TRE_ID_LOCAL}"
local MY_IP="${PUBLIC_DEPLOYMENT_IP_ADDRESS:-}"

if [[ -z "$MY_IP" ]]; then
Expand Down

0 comments on commit 135be76

Please sign in to comment.