INFRA-3721 | Ankit Bhardwaj | fix test
This commit is contained in:
@@ -1,13 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -xe
|
||||
set -e
|
||||
|
||||
additional_terraform_options=""
|
||||
additional_terraform_options="${additional_terraform_options} -auto-approve"
|
||||
function echo_and_run {
|
||||
echo "Running command: $*"
|
||||
eval "$*"
|
||||
}
|
||||
|
||||
terraform119 init
|
||||
terraform119 workspace select nonprod.np.navi-tech.in || terraform119 workspace new nonprod.np.navi-tech.in
|
||||
terraform_action=apply
|
||||
terraform119 $terraform_action -target=module.rds.data.aws_subnet_ids.command_private_subnets $additional_terraform_options
|
||||
terraform119 $terraform_action -target=module.rds.module.rds_aurora_instance $additional_terraform_options
|
||||
terraform119 $terraform_action -target=module.rds.module.postgres_db $additional_terraform_options
|
||||
echo_and_run 'additional_terraform_options=""'
|
||||
echo_and_run 'additional_terraform_options="${additional_terraform_options} -auto-approve"'
|
||||
|
||||
echo_and_run "terraform119 init"
|
||||
echo_and_run "terraform119 workspace select nonprod.np.navi-tech.in || terraform119 workspace new nonprod.np.navi-tech.in"
|
||||
echo_and_run "terraform_action=apply"
|
||||
echo_and_run "terraform119 $terraform_action -target=module.rds.data.aws_subnet_ids.command_private_subnets $additional_terraform_options"
|
||||
echo_and_run "terraform119 $terraform_action -target=module.rds.module.rds_aurora_instance $additional_terraform_options"
|
||||
echo_and_run "terraform119 $terraform_action -target=module.rds.module.postgres_db $additional_terraform_options"
|
||||
|
||||
@@ -1,29 +1,31 @@
|
||||
#!/bin/sh
|
||||
|
||||
# exit when any command fails
|
||||
set -xe
|
||||
set -e
|
||||
|
||||
additional_terraform_options=""
|
||||
additional_kube_options=""
|
||||
terraform_action=apply
|
||||
additional_terraform_options="${additional_terraform_options} -auto-approve"
|
||||
function echo_and_run {
|
||||
echo "Running command: $*"
|
||||
eval "$*"
|
||||
}
|
||||
|
||||
echo_and_run 'additional_terraform_options=""'
|
||||
echo_and_run 'additional_kube_options=""'
|
||||
echo_and_run "terraform_action=apply"
|
||||
echo_and_run 'additional_terraform_options="${additional_terraform_options} -auto-approve"'
|
||||
|
||||
|
||||
terraform init
|
||||
terraform workspace select nonprod.np.navi-tech.in || terraform workspace new nonprod.np.navi-tech.in
|
||||
echo_and_run "terraform init"
|
||||
echo_and_run "terraform workspace select nonprod.np.navi-tech.in || terraform workspace new nonprod.np.navi-tech.in"
|
||||
|
||||
providers=$(terraform providers | grep 'registry.terraform.io/-' | awk -F "[" '{print $2}' | sed 's/.$//')
|
||||
echo_and_run "providers=$(terraform providers | grep 'registry.terraform.io/-' | awk -F '[' '{print $2}' | sed 's/.$//')"
|
||||
printf '\n'
|
||||
for provider in $providers; do
|
||||
correct_provider="${provider//-/hashicorp}"
|
||||
echo "executing"
|
||||
echo "terraform state replace-provider -auto-approve $provider $correct_provider"
|
||||
terraform state replace-provider -auto-approve "$provider" "$correct_provider"
|
||||
echo_and_run 'terraform state replace-provider -auto-approve "$provider" "$correct_provider"'
|
||||
done
|
||||
printf '\n'
|
||||
|
||||
kubectl config use-context nonprod.np.navi-tech.in
|
||||
namespace=dev-3p
|
||||
filename=foo-navi-service-dev.yaml
|
||||
terraform $terraform_action $additional_terraform_options
|
||||
kubectl apply -f $filename -n $namespace $additional_kube_options
|
||||
echo_and_run "kubectl config use-context nonprod.np.navi-tech.in"
|
||||
echo_and_run "namespace=dev-3p"
|
||||
echo_and_run 'filename=foo-navi-service-dev.yaml'
|
||||
echo_and_run "terraform $terraform_action $additional_terraform_options"
|
||||
echo_and_run "kubectl apply -f $filename -n $namespace $additional_kube_options"
|
||||
|
||||
@@ -1,25 +1,26 @@
|
||||
#!/bin/sh
|
||||
|
||||
# exit when any command fails
|
||||
set -xe
|
||||
set -e
|
||||
|
||||
additional_terraform_options=""
|
||||
function echo_and_run {
|
||||
echo "Running command: $*"
|
||||
eval "$*"
|
||||
}
|
||||
|
||||
echo_and_run 'additional_terraform_options=""'
|
||||
|
||||
terraform_action=apply
|
||||
additional_terraform_options="${additional_terraform_options} -auto-approve"
|
||||
echo_and_run 'additional_terraform_options="${additional_terraform_options} -auto-approve"'
|
||||
|
||||
|
||||
terraform init
|
||||
terraform workspace select nonprod.np.navi-tech.in || terraform workspace new nonprod.np.navi-tech.in
|
||||
echo_and_run "terraform init"
|
||||
echo_and_run "terraform workspace select nonprod.np.navi-tech.in || terraform workspace new nonprod.np.navi-tech.in"
|
||||
|
||||
providers=$(terraform providers | grep 'registry.terraform.io/-' | awk -F "[" '{print $2}' | sed 's/.$//')
|
||||
printf '\n'
|
||||
echo_and_run "providers=$(terraform providers | grep 'registry.terraform.io/-' | awk -F '[' '{print $2}' | sed 's/.$//')"
|
||||
for provider in $providers; do
|
||||
correct_provider="${provider//-/hashicorp}"
|
||||
echo "executing"
|
||||
echo "terraform state replace-provider -auto-approve $provider $correct_provider"
|
||||
terraform state replace-provider -auto-approve "$provider" "$correct_provider"
|
||||
echo_and_run 'terraform state replace-provider -auto-approve "$provider" "$correct_provider"'
|
||||
done
|
||||
printf '\n'
|
||||
|
||||
terraform $terraform_action $additional_terraform_options
|
||||
echo_and_run "terraform $terraform_action $additional_terraform_options"
|
||||
|
||||
@@ -1,24 +1,25 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -xe
|
||||
set -e
|
||||
|
||||
additional_terraform_options=""
|
||||
function echo_and_run {
|
||||
echo "Running command: $*"
|
||||
eval "$*"
|
||||
}
|
||||
|
||||
echo_and_run 'additional_terraform_options=""'
|
||||
|
||||
terraform_action=apply
|
||||
additional_terraform_options="${additional_terraform_options} -auto-approve"
|
||||
echo_and_run 'additional_terraform_options="${additional_terraform_options} -auto-approve"'
|
||||
|
||||
|
||||
terraform init
|
||||
terraform workspace select nonprod.np.navi-tech.in || terraform workspace new nonprod.np.navi-tech.in
|
||||
echo_and_run 'terraform init'
|
||||
echo_and_run 'terraform workspace select nonprod.np.navi-tech.in || terraform workspace new nonprod.np.navi-tech.in'
|
||||
|
||||
providers=$(terraform providers | grep 'registry.terraform.io/-' | awk -F "[" '{print $2}' | sed 's/.$//')
|
||||
printf '\n'
|
||||
echo_and_run "providers=$(terraform providers | grep 'registry.terraform.io/-' | awk -F '[' '{print $2}' | sed 's/.$//')"
|
||||
for provider in $providers; do
|
||||
correct_provider="${provider//-/hashicorp}"
|
||||
echo "executing"
|
||||
echo "terraform state replace-provider -auto-approve $provider $correct_provider"
|
||||
terraform state replace-provider -auto-approve "$provider" "$correct_provider"
|
||||
echo_and_run 'terraform state replace-provider -auto-approve "$provider" "$correct_provider"'
|
||||
done
|
||||
printf '\n'
|
||||
|
||||
terraform $terraform_action $additional_terraform_options
|
||||
echo_and_run "terraform $terraform_action $additional_terraform_options"
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -xe
|
||||
set -e
|
||||
|
||||
additional_terraform_options=""
|
||||
function echo_and_run {
|
||||
echo "Running command: $*"
|
||||
eval "$*"
|
||||
}
|
||||
|
||||
echo_and_run 'additional_terraform_options=""'
|
||||
|
||||
terraform_action=apply
|
||||
additional_terraform_options="${additional_terraform_options} -auto-approve"
|
||||
echo_and_run 'additional_terraform_options="${additional_terraform_options} -auto-approve"'
|
||||
|
||||
|
||||
terraform init
|
||||
terraform workspace select nonprod.np.navi-tech.in || terraform workspace new nonprod.np.navi-tech.in
|
||||
terraform $terraform_action $additional_terraform_options
|
||||
echo_and_run "terraform init"
|
||||
echo_and_run "terraform workspace select nonprod.np.navi-tech.in || terraform workspace new nonprod.np.navi-tech.in"
|
||||
echo_and_run "terraform $terraform_action $additional_terraform_options"
|
||||
|
||||
@@ -1,25 +1,23 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -xe
|
||||
set -e
|
||||
function echo_and_run {
|
||||
echo "Running command: $*"
|
||||
eval "$*"
|
||||
}
|
||||
|
||||
additional_terraform_options=""
|
||||
echo_and_run 'additional_terraform_options=""'
|
||||
|
||||
terraform_action=apply
|
||||
additional_terraform_options="${additional_terraform_options} -auto-approve"
|
||||
echo_and_run 'additional_terraform_options="${additional_terraform_options} -auto-approve"'
|
||||
|
||||
|
||||
terraform init
|
||||
terraform workspace select nonprod.np.navi-tech.in || terraform workspace new nonprod.np.navi-tech.in
|
||||
echo_and_run "terraform init"
|
||||
echo_and_run "terraform workspace select nonprod.np.navi-tech.in || terraform workspace new nonprod.np.navi-tech.in"
|
||||
|
||||
providers=$(terraform providers | grep 'registry.terraform.io/-' | awk -F "[" '{print $2}' | sed 's/.$//')
|
||||
printf '\n'
|
||||
echo_and_run "providers=$(terraform providers | grep 'registry.terraform.io/-' | awk -F '[' '{print $2}' | sed 's/.$//')"
|
||||
for provider in $providers; do
|
||||
correct_provider="${provider//-/hashicorp}"
|
||||
echo "executing"
|
||||
echo "terraform state replace-provider -auto-approve $provider $correct_provider"
|
||||
terraform state replace-provider -auto-approve "$provider" "$correct_provider"
|
||||
echo_and_run 'terraform state replace-provider -auto-approve "$provider" "$correct_provider"'
|
||||
done
|
||||
printf '\n'
|
||||
|
||||
|
||||
terraform $terraform_action $additional_terraform_options
|
||||
echo_and_run "terraform $terraform_action $additional_terraform_options"
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -xe
|
||||
set -e
|
||||
|
||||
function echo_and_run {
|
||||
echo "Running command: $*"
|
||||
eval "$*"
|
||||
}
|
||||
|
||||
|
||||
function state_migration() {
|
||||
# remove option group from terraform state as option group api is removed by aws for postgres and we can't delete option group as its used by snapshot.
|
||||
@@ -14,30 +20,26 @@ function state_migration() {
|
||||
}
|
||||
|
||||
additional_terraform_options=""
|
||||
additional_terraform_options="${additional_terraform_options} -auto-approve"
|
||||
echo_and_run 'additional_terraform_options="${additional_terraform_options} -auto-approve"'
|
||||
|
||||
|
||||
terraform init
|
||||
terraform workspace select nonprod.np.navi-tech.in || terraform workspace new nonprod.np.navi-tech.in
|
||||
echo_and_run "terraform init"
|
||||
echo_and_run "terraform workspace select nonprod.np.navi-tech.in || terraform workspace new nonprod.np.navi-tech.in"
|
||||
|
||||
providers=$(terraform providers | grep 'registry.terraform.io/-' | awk -F "[" '{print $2}' | sed 's/.$//')
|
||||
printf '\n'
|
||||
echo_and_run "providers=$(terraform providers | grep 'registry.terraform.io/-' | awk -F '[' '{print $2}' | sed 's/.$//')"
|
||||
for provider in $providers; do
|
||||
if echo "$provider" | grep -q "postgres"; then
|
||||
correct_provider="${provider//-/cyrilgdn}"
|
||||
else
|
||||
correct_provider="${provider//-/hashicorp}"
|
||||
fi
|
||||
echo "executing"
|
||||
echo "terraform state replace-provider -auto-approve $provider $correct_provider"
|
||||
terraform state replace-provider -auto-approve "$provider" "$correct_provider"
|
||||
echo_and_run 'terraform state replace-provider -auto-approve "$provider" "$correct_provider"'
|
||||
done
|
||||
printf '\n'
|
||||
terraform state list | grep 'module.rds.module.postgres_db.postgresql_database.this' && terraform state rm 'module.rds.module.postgres_db.postgresql_database.this'
|
||||
echo_and_run "(terraform state list | grep 'module.rds.module.postgres_db.postgresql_database.this' && terraform state rm 'module.rds.module.postgres_db.postgresql_database.this') || true"
|
||||
state_migration
|
||||
terraform_action=apply
|
||||
terraform $terraform_action -target=module.rds.data.aws_subnet_ids.command_private_subnets -target=module.rds.data.aws_subnets.command_private_subnets $additional_terraform_options
|
||||
terraform $terraform_action -target=module.rds.module.rds_instance -target=module.rds.module.rds_instance_replica $additional_terraform_options
|
||||
terraform $terraform_action -target=module.rds.module.postgres_db $additional_terraform_options
|
||||
echo_and_run "terraform_action=apply"
|
||||
echo_and_run "terraform $terraform_action -target=module.rds.data.aws_subnet_ids.command_private_subnets -target=module.rds.data.aws_subnets.command_private_subnets $additional_terraform_options"
|
||||
echo_and_run "terraform $terraform_action -target=module.rds.module.rds_instance -target=module.rds.module.rds_instance_replica $additional_terraform_options"
|
||||
echo_and_run "terraform $terraform_action -target=module.rds.module.postgres_db $additional_terraform_options"
|
||||
|
||||
# TODO: remove -target=module.rds.data.aws_subnet_ids.command_private_subnets once terraform rds migration(specific storage_type for rds -> gp3) is complete [7 September 2023]
|
||||
|
||||
@@ -91,7 +91,7 @@ EOF
|
||||
}
|
||||
|
||||
check_lag_status() {
|
||||
LAG_STATUS_QUERY="SELECT ${slot_name}, restart_lsn - '0/0' AS lsn_on_rs, pg_current_wal_lsn() - '0/0' AS curr_wal_lsn, pg_wal_lsn_diff(pg_current_wal_lsn(), restart_lsn) AS lsn_lag, active FROM pg_replication_slots"
|
||||
LAG_STATUS_QUERY="SELECT slot_name, restart_lsn - '0/0' AS lsn_on_rs, pg_current_wal_lsn() - '0/0' AS curr_wal_lsn, pg_wal_lsn_diff(pg_current_wal_lsn(), restart_lsn) AS lsn_lag, active FROM pg_replication_slots"
|
||||
|
||||
while true; do
|
||||
lag=$(
|
||||
@@ -108,11 +108,11 @@ print(lag)
|
||||
EOF
|
||||
)
|
||||
|
||||
if [ "${lag}" -le 10 ]; then
|
||||
echo "Lag has become 0, proceeding ahead"
|
||||
if [ "${lag}" -le 10000 ]; then
|
||||
echo "Lag has become less than 10000, proceeding ahead"
|
||||
break
|
||||
else
|
||||
echo "Lag has not become 0, waiting"
|
||||
echo "Lag has not become 10000, waiting"
|
||||
sleep 10
|
||||
fi
|
||||
done
|
||||
@@ -150,6 +150,10 @@ EOF
|
||||
}
|
||||
|
||||
parse_connector_config
|
||||
if [ $? != 0 ]; then
|
||||
echo "Could not parse connector config, exiting"
|
||||
exit 0
|
||||
fi
|
||||
set_database_in_read_only
|
||||
wait_untill_database_ready
|
||||
#-----------------------------------------DATABASE is considered ready after this------------
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -xe
|
||||
set -e
|
||||
|
||||
additional_terraform_options=""
|
||||
additional_terraform_options="${additional_terraform_options} -auto-approve"
|
||||
function echo_and_run {
|
||||
echo "Running command: $*"
|
||||
eval "$*"
|
||||
}
|
||||
|
||||
terraform119 init
|
||||
terraform119 workspace select aps1.np.navi-gi.in || terraform119 workspace new aps1.np.navi-gi.in
|
||||
terraform_action=apply
|
||||
terraform119 $terraform_action -target=module.rds.data.aws_subnet_ids.command_private_subnets $additional_terraform_options
|
||||
terraform119 $terraform_action -target=module.rds.module.rds_aurora_instance $additional_terraform_options
|
||||
terraform119 $terraform_action -target=module.rds.module.postgres_db $additional_terraform_options
|
||||
echo_and_run 'additional_terraform_options=""'
|
||||
echo_and_run 'additional_terraform_options="${additional_terraform_options} -auto-approve"'
|
||||
|
||||
echo_and_run "terraform119 init"
|
||||
echo_and_run "terraform119 workspace select aps1.np.navi-gi.in || terraform119 workspace new aps1.np.navi-gi.in"
|
||||
echo_and_run "terraform_action=apply"
|
||||
echo_and_run "terraform119 $terraform_action -target=module.rds.data.aws_subnet_ids.command_private_subnets $additional_terraform_options"
|
||||
echo_and_run "terraform119 $terraform_action -target=module.rds.module.rds_aurora_instance $additional_terraform_options"
|
||||
echo_and_run "terraform119 $terraform_action -target=module.rds.module.postgres_db $additional_terraform_options"
|
||||
|
||||
@@ -1,29 +1,31 @@
|
||||
#!/bin/sh
|
||||
|
||||
# exit when any command fails
|
||||
set -xe
|
||||
set -e
|
||||
|
||||
additional_terraform_options=""
|
||||
additional_kube_options=""
|
||||
terraform_action=apply
|
||||
additional_terraform_options="${additional_terraform_options} -auto-approve"
|
||||
function echo_and_run {
|
||||
echo "Running command: $*"
|
||||
eval "$*"
|
||||
}
|
||||
|
||||
echo_and_run 'additional_terraform_options=""'
|
||||
echo_and_run 'additional_kube_options=""'
|
||||
echo_and_run "terraform_action=apply"
|
||||
echo_and_run 'additional_terraform_options="${additional_terraform_options} -auto-approve"'
|
||||
|
||||
|
||||
terraform init
|
||||
terraform workspace select aps1.np.navi-gi.in || terraform workspace new aps1.np.navi-gi.in
|
||||
echo_and_run "terraform init"
|
||||
echo_and_run "terraform workspace select aps1.np.navi-gi.in || terraform workspace new aps1.np.navi-gi.in"
|
||||
|
||||
providers=$(terraform providers | grep 'registry.terraform.io/-' | awk -F "[" '{print $2}' | sed 's/.$//')
|
||||
echo_and_run "providers=$(terraform providers | grep 'registry.terraform.io/-' | awk -F '[' '{print $2}' | sed 's/.$//')"
|
||||
printf '\n'
|
||||
for provider in $providers; do
|
||||
correct_provider="${provider//-/hashicorp}"
|
||||
echo "executing"
|
||||
echo "terraform state replace-provider -auto-approve $provider $correct_provider"
|
||||
terraform state replace-provider -auto-approve "$provider" "$correct_provider"
|
||||
echo_and_run 'terraform state replace-provider -auto-approve "$provider" "$correct_provider"'
|
||||
done
|
||||
printf '\n'
|
||||
|
||||
kubectl config use-context aps1.np.navi-gi.in
|
||||
namespace=dev-3p
|
||||
filename=foo-navi-service-dev.yaml
|
||||
terraform $terraform_action $additional_terraform_options
|
||||
kubectl apply -f $filename -n $namespace $additional_kube_options
|
||||
echo_and_run "kubectl config use-context aps1.np.navi-gi.in"
|
||||
echo_and_run "namespace=dev-3p"
|
||||
echo_and_run 'filename=foo-navi-service-dev.yaml'
|
||||
echo_and_run "terraform $terraform_action $additional_terraform_options"
|
||||
echo_and_run "kubectl apply -f $filename -n $namespace $additional_kube_options"
|
||||
|
||||
@@ -1,25 +1,26 @@
|
||||
#!/bin/sh
|
||||
|
||||
# exit when any command fails
|
||||
set -xe
|
||||
set -e
|
||||
|
||||
additional_terraform_options=""
|
||||
function echo_and_run {
|
||||
echo "Running command: $*"
|
||||
eval "$*"
|
||||
}
|
||||
|
||||
echo_and_run 'additional_terraform_options=""'
|
||||
|
||||
terraform_action=apply
|
||||
additional_terraform_options="${additional_terraform_options} -auto-approve"
|
||||
echo_and_run 'additional_terraform_options="${additional_terraform_options} -auto-approve"'
|
||||
|
||||
|
||||
terraform init
|
||||
terraform workspace select aps1.np.navi-gi.in || terraform workspace new aps1.np.navi-gi.in
|
||||
echo_and_run "terraform init"
|
||||
echo_and_run "terraform workspace select aps1.np.navi-gi.in || terraform workspace new aps1.np.navi-gi.in"
|
||||
|
||||
providers=$(terraform providers | grep 'registry.terraform.io/-' | awk -F "[" '{print $2}' | sed 's/.$//')
|
||||
printf '\n'
|
||||
echo_and_run "providers=$(terraform providers | grep 'registry.terraform.io/-' | awk -F '[' '{print $2}' | sed 's/.$//')"
|
||||
for provider in $providers; do
|
||||
correct_provider="${provider//-/hashicorp}"
|
||||
echo "executing"
|
||||
echo "terraform state replace-provider -auto-approve $provider $correct_provider"
|
||||
terraform state replace-provider -auto-approve "$provider" "$correct_provider"
|
||||
echo_and_run 'terraform state replace-provider -auto-approve "$provider" "$correct_provider"'
|
||||
done
|
||||
printf '\n'
|
||||
|
||||
terraform $terraform_action $additional_terraform_options
|
||||
echo_and_run "terraform $terraform_action $additional_terraform_options"
|
||||
|
||||
@@ -1,24 +1,25 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -xe
|
||||
set -e
|
||||
|
||||
additional_terraform_options=""
|
||||
function echo_and_run {
|
||||
echo "Running command: $*"
|
||||
eval "$*"
|
||||
}
|
||||
|
||||
echo_and_run 'additional_terraform_options=""'
|
||||
|
||||
terraform_action=apply
|
||||
additional_terraform_options="${additional_terraform_options} -auto-approve"
|
||||
echo_and_run 'additional_terraform_options="${additional_terraform_options} -auto-approve"'
|
||||
|
||||
|
||||
terraform init
|
||||
terraform workspace select aps1.np.navi-gi.in || terraform workspace new aps1.np.navi-gi.in
|
||||
echo_and_run 'terraform init'
|
||||
echo_and_run 'terraform workspace select aps1.np.navi-gi.in || terraform workspace new aps1.np.navi-gi.in'
|
||||
|
||||
providers=$(terraform providers | grep 'registry.terraform.io/-' | awk -F "[" '{print $2}' | sed 's/.$//')
|
||||
printf '\n'
|
||||
echo_and_run "providers=$(terraform providers | grep 'registry.terraform.io/-' | awk -F '[' '{print $2}' | sed 's/.$//')"
|
||||
for provider in $providers; do
|
||||
correct_provider="${provider//-/hashicorp}"
|
||||
echo "executing"
|
||||
echo "terraform state replace-provider -auto-approve $provider $correct_provider"
|
||||
terraform state replace-provider -auto-approve "$provider" "$correct_provider"
|
||||
echo_and_run 'terraform state replace-provider -auto-approve "$provider" "$correct_provider"'
|
||||
done
|
||||
printf '\n'
|
||||
|
||||
terraform $terraform_action $additional_terraform_options
|
||||
echo_and_run "terraform $terraform_action $additional_terraform_options"
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -xe
|
||||
set -e
|
||||
|
||||
additional_terraform_options=""
|
||||
function echo_and_run {
|
||||
echo "Running command: $*"
|
||||
eval "$*"
|
||||
}
|
||||
|
||||
echo_and_run 'additional_terraform_options=""'
|
||||
|
||||
terraform_action=apply
|
||||
additional_terraform_options="${additional_terraform_options} -auto-approve"
|
||||
echo_and_run 'additional_terraform_options="${additional_terraform_options} -auto-approve"'
|
||||
|
||||
|
||||
terraform init
|
||||
terraform workspace select aps1.np.navi-gi.in || terraform workspace new aps1.np.navi-gi.in
|
||||
terraform $terraform_action $additional_terraform_options
|
||||
echo_and_run "terraform init"
|
||||
echo_and_run "terraform workspace select aps1.np.navi-gi.in || terraform workspace new aps1.np.navi-gi.in"
|
||||
echo_and_run "terraform $terraform_action $additional_terraform_options"
|
||||
|
||||
@@ -1,25 +1,23 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -xe
|
||||
set -e
|
||||
function echo_and_run {
|
||||
echo "Running command: $*"
|
||||
eval "$*"
|
||||
}
|
||||
|
||||
additional_terraform_options=""
|
||||
echo_and_run 'additional_terraform_options=""'
|
||||
|
||||
terraform_action=apply
|
||||
additional_terraform_options="${additional_terraform_options} -auto-approve"
|
||||
echo_and_run 'additional_terraform_options="${additional_terraform_options} -auto-approve"'
|
||||
|
||||
|
||||
terraform init
|
||||
terraform workspace select aps1.np.navi-gi.in || terraform workspace new aps1.np.navi-gi.in
|
||||
echo_and_run "terraform init"
|
||||
echo_and_run "terraform workspace select aps1.np.navi-gi.in || terraform workspace new aps1.np.navi-gi.in"
|
||||
|
||||
providers=$(terraform providers | grep 'registry.terraform.io/-' | awk -F "[" '{print $2}' | sed 's/.$//')
|
||||
printf '\n'
|
||||
echo_and_run "providers=$(terraform providers | grep 'registry.terraform.io/-' | awk -F '[' '{print $2}' | sed 's/.$//')"
|
||||
for provider in $providers; do
|
||||
correct_provider="${provider//-/hashicorp}"
|
||||
echo "executing"
|
||||
echo "terraform state replace-provider -auto-approve $provider $correct_provider"
|
||||
terraform state replace-provider -auto-approve "$provider" "$correct_provider"
|
||||
echo_and_run 'terraform state replace-provider -auto-approve "$provider" "$correct_provider"'
|
||||
done
|
||||
printf '\n'
|
||||
|
||||
|
||||
terraform $terraform_action $additional_terraform_options
|
||||
echo_and_run "terraform $terraform_action $additional_terraform_options"
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -xe
|
||||
set -e
|
||||
|
||||
function echo_and_run {
|
||||
echo "Running command: $*"
|
||||
eval "$*"
|
||||
}
|
||||
|
||||
|
||||
function state_migration() {
|
||||
# remove option group from terraform state as option group api is removed by aws for postgres and we can't delete option group as its used by snapshot.
|
||||
@@ -14,30 +20,26 @@ function state_migration() {
|
||||
}
|
||||
|
||||
additional_terraform_options=""
|
||||
additional_terraform_options="${additional_terraform_options} -auto-approve"
|
||||
echo_and_run 'additional_terraform_options="${additional_terraform_options} -auto-approve"'
|
||||
|
||||
|
||||
terraform init
|
||||
terraform workspace select aps1.np.navi-gi.in || terraform workspace new aps1.np.navi-gi.in
|
||||
echo_and_run "terraform init"
|
||||
echo_and_run "terraform workspace select aps1.np.navi-gi.in || terraform workspace new aps1.np.navi-gi.in"
|
||||
|
||||
providers=$(terraform providers | grep 'registry.terraform.io/-' | awk -F "[" '{print $2}' | sed 's/.$//')
|
||||
printf '\n'
|
||||
echo_and_run "providers=$(terraform providers | grep 'registry.terraform.io/-' | awk -F '[' '{print $2}' | sed 's/.$//')"
|
||||
for provider in $providers; do
|
||||
if echo "$provider" | grep -q "postgres"; then
|
||||
correct_provider="${provider//-/cyrilgdn}"
|
||||
else
|
||||
correct_provider="${provider//-/hashicorp}"
|
||||
fi
|
||||
echo "executing"
|
||||
echo "terraform state replace-provider -auto-approve $provider $correct_provider"
|
||||
terraform state replace-provider -auto-approve "$provider" "$correct_provider"
|
||||
echo_and_run 'terraform state replace-provider -auto-approve "$provider" "$correct_provider"'
|
||||
done
|
||||
printf '\n'
|
||||
terraform state list | grep 'module.rds.module.postgres_db.postgresql_database.this' && terraform state rm 'module.rds.module.postgres_db.postgresql_database.this'
|
||||
echo_and_run "(terraform state list | grep 'module.rds.module.postgres_db.postgresql_database.this' && terraform state rm 'module.rds.module.postgres_db.postgresql_database.this') || true"
|
||||
state_migration
|
||||
terraform_action=apply
|
||||
terraform $terraform_action -target=module.rds.data.aws_subnet_ids.command_private_subnets -target=module.rds.data.aws_subnets.command_private_subnets $additional_terraform_options
|
||||
terraform $terraform_action -target=module.rds.module.rds_instance -target=module.rds.module.rds_instance_replica $additional_terraform_options
|
||||
terraform $terraform_action -target=module.rds.module.postgres_db $additional_terraform_options
|
||||
echo_and_run "terraform_action=apply"
|
||||
echo_and_run "terraform $terraform_action -target=module.rds.data.aws_subnet_ids.command_private_subnets -target=module.rds.data.aws_subnets.command_private_subnets $additional_terraform_options"
|
||||
echo_and_run "terraform $terraform_action -target=module.rds.module.rds_instance -target=module.rds.module.rds_instance_replica $additional_terraform_options"
|
||||
echo_and_run "terraform $terraform_action -target=module.rds.module.postgres_db $additional_terraform_options"
|
||||
|
||||
# TODO: remove -target=module.rds.data.aws_subnet_ids.command_private_subnets once terraform rds migration(specific storage_type for rds -> gp3) is complete [7 September 2023]
|
||||
|
||||
@@ -91,7 +91,7 @@ EOF
|
||||
}
|
||||
|
||||
check_lag_status() {
|
||||
LAG_STATUS_QUERY="SELECT ${slot_name}, restart_lsn - '0/0' AS lsn_on_rs, pg_current_wal_lsn() - '0/0' AS curr_wal_lsn, pg_wal_lsn_diff(pg_current_wal_lsn(), restart_lsn) AS lsn_lag, active FROM pg_replication_slots"
|
||||
LAG_STATUS_QUERY="SELECT slot_name, restart_lsn - '0/0' AS lsn_on_rs, pg_current_wal_lsn() - '0/0' AS curr_wal_lsn, pg_wal_lsn_diff(pg_current_wal_lsn(), restart_lsn) AS lsn_lag, active FROM pg_replication_slots"
|
||||
|
||||
while true; do
|
||||
lag=$(
|
||||
@@ -108,11 +108,11 @@ print(lag)
|
||||
EOF
|
||||
)
|
||||
|
||||
if [ "${lag}" -le 10 ]; then
|
||||
echo "Lag has become 0, proceeding ahead"
|
||||
if [ "${lag}" -le 10000 ]; then
|
||||
echo "Lag has become less than 10000, proceeding ahead"
|
||||
break
|
||||
else
|
||||
echo "Lag has not become 0, waiting"
|
||||
echo "Lag has not become 10000, waiting"
|
||||
sleep 10
|
||||
fi
|
||||
done
|
||||
@@ -150,6 +150,10 @@ EOF
|
||||
}
|
||||
|
||||
parse_connector_config
|
||||
if [ $? != 0 ]; then
|
||||
echo "Could not parse connector config, exiting"
|
||||
exit 0
|
||||
fi
|
||||
set_database_in_read_only
|
||||
wait_untill_database_ready
|
||||
#-----------------------------------------DATABASE is considered ready after this------------
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -xe
|
||||
set -e
|
||||
|
||||
additional_terraform_options=""
|
||||
additional_terraform_options="${additional_terraform_options} -auto-approve"
|
||||
function echo_and_run {
|
||||
echo "Running command: $*"
|
||||
eval "$*"
|
||||
}
|
||||
|
||||
terraform119 init
|
||||
terraform119 workspace select aps1.np.navi-gi.in || terraform119 workspace new aps1.np.navi-gi.in
|
||||
terraform_action=apply
|
||||
terraform119 $terraform_action -target=module.rds.data.aws_subnet_ids.command_private_subnets $additional_terraform_options
|
||||
terraform119 $terraform_action -target=module.rds.module.rds_aurora_instance $additional_terraform_options
|
||||
terraform119 $terraform_action -target=module.rds.module.postgres_db $additional_terraform_options
|
||||
echo_and_run 'additional_terraform_options=""'
|
||||
echo_and_run 'additional_terraform_options="${additional_terraform_options} -auto-approve"'
|
||||
|
||||
echo_and_run "terraform119 init"
|
||||
echo_and_run "terraform119 workspace select aps1.np.navi-gi.in || terraform119 workspace new aps1.np.navi-gi.in"
|
||||
echo_and_run "terraform_action=apply"
|
||||
echo_and_run "terraform119 $terraform_action -target=module.rds.data.aws_subnet_ids.command_private_subnets $additional_terraform_options"
|
||||
echo_and_run "terraform119 $terraform_action -target=module.rds.module.rds_aurora_instance $additional_terraform_options"
|
||||
echo_and_run "terraform119 $terraform_action -target=module.rds.module.postgres_db $additional_terraform_options"
|
||||
|
||||
@@ -1,29 +1,31 @@
|
||||
#!/bin/sh
|
||||
|
||||
# exit when any command fails
|
||||
set -xe
|
||||
set -e
|
||||
|
||||
additional_terraform_options=""
|
||||
additional_kube_options=""
|
||||
terraform_action=apply
|
||||
additional_terraform_options="${additional_terraform_options} -auto-approve"
|
||||
function echo_and_run {
|
||||
echo "Running command: $*"
|
||||
eval "$*"
|
||||
}
|
||||
|
||||
echo_and_run 'additional_terraform_options=""'
|
||||
echo_and_run 'additional_kube_options=""'
|
||||
echo_and_run "terraform_action=apply"
|
||||
echo_and_run 'additional_terraform_options="${additional_terraform_options} -auto-approve"'
|
||||
|
||||
|
||||
terraform init
|
||||
terraform workspace select aps1.np.navi-gi.in || terraform workspace new aps1.np.navi-gi.in
|
||||
echo_and_run "terraform init"
|
||||
echo_and_run "terraform workspace select aps1.np.navi-gi.in || terraform workspace new aps1.np.navi-gi.in"
|
||||
|
||||
providers=$(terraform providers | grep 'registry.terraform.io/-' | awk -F "[" '{print $2}' | sed 's/.$//')
|
||||
echo_and_run "providers=$(terraform providers | grep 'registry.terraform.io/-' | awk -F '[' '{print $2}' | sed 's/.$//')"
|
||||
printf '\n'
|
||||
for provider in $providers; do
|
||||
correct_provider="${provider//-/hashicorp}"
|
||||
echo "executing"
|
||||
echo "terraform state replace-provider -auto-approve $provider $correct_provider"
|
||||
terraform state replace-provider -auto-approve "$provider" "$correct_provider"
|
||||
echo_and_run 'terraform state replace-provider -auto-approve "$provider" "$correct_provider"'
|
||||
done
|
||||
printf '\n'
|
||||
|
||||
kubectl config use-context aps1.np.navi-gi.in
|
||||
namespace=flink
|
||||
filename=foo-navi-service-dev.yaml
|
||||
terraform $terraform_action $additional_terraform_options
|
||||
kubectl apply -f $filename -n $namespace $additional_kube_options
|
||||
echo_and_run "kubectl config use-context aps1.np.navi-gi.in"
|
||||
echo_and_run "namespace=flink"
|
||||
echo_and_run 'filename=foo-navi-service-dev.yaml'
|
||||
echo_and_run "terraform $terraform_action $additional_terraform_options"
|
||||
echo_and_run "kubectl apply -f $filename -n $namespace $additional_kube_options"
|
||||
|
||||
@@ -1,25 +1,26 @@
|
||||
#!/bin/sh
|
||||
|
||||
# exit when any command fails
|
||||
set -xe
|
||||
set -e
|
||||
|
||||
additional_terraform_options=""
|
||||
function echo_and_run {
|
||||
echo "Running command: $*"
|
||||
eval "$*"
|
||||
}
|
||||
|
||||
echo_and_run 'additional_terraform_options=""'
|
||||
|
||||
terraform_action=apply
|
||||
additional_terraform_options="${additional_terraform_options} -auto-approve"
|
||||
echo_and_run 'additional_terraform_options="${additional_terraform_options} -auto-approve"'
|
||||
|
||||
|
||||
terraform init
|
||||
terraform workspace select aps1.np.navi-gi.in || terraform workspace new aps1.np.navi-gi.in
|
||||
echo_and_run "terraform init"
|
||||
echo_and_run "terraform workspace select aps1.np.navi-gi.in || terraform workspace new aps1.np.navi-gi.in"
|
||||
|
||||
providers=$(terraform providers | grep 'registry.terraform.io/-' | awk -F "[" '{print $2}' | sed 's/.$//')
|
||||
printf '\n'
|
||||
echo_and_run "providers=$(terraform providers | grep 'registry.terraform.io/-' | awk -F '[' '{print $2}' | sed 's/.$//')"
|
||||
for provider in $providers; do
|
||||
correct_provider="${provider//-/hashicorp}"
|
||||
echo "executing"
|
||||
echo "terraform state replace-provider -auto-approve $provider $correct_provider"
|
||||
terraform state replace-provider -auto-approve "$provider" "$correct_provider"
|
||||
echo_and_run 'terraform state replace-provider -auto-approve "$provider" "$correct_provider"'
|
||||
done
|
||||
printf '\n'
|
||||
|
||||
terraform $terraform_action $additional_terraform_options
|
||||
echo_and_run "terraform $terraform_action $additional_terraform_options"
|
||||
|
||||
@@ -1,24 +1,25 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -xe
|
||||
set -e
|
||||
|
||||
additional_terraform_options=""
|
||||
function echo_and_run {
|
||||
echo "Running command: $*"
|
||||
eval "$*"
|
||||
}
|
||||
|
||||
echo_and_run 'additional_terraform_options=""'
|
||||
|
||||
terraform_action=apply
|
||||
additional_terraform_options="${additional_terraform_options} -auto-approve"
|
||||
echo_and_run 'additional_terraform_options="${additional_terraform_options} -auto-approve"'
|
||||
|
||||
|
||||
terraform init
|
||||
terraform workspace select aps1.np.navi-gi.in || terraform workspace new aps1.np.navi-gi.in
|
||||
echo_and_run 'terraform init'
|
||||
echo_and_run 'terraform workspace select aps1.np.navi-gi.in || terraform workspace new aps1.np.navi-gi.in'
|
||||
|
||||
providers=$(terraform providers | grep 'registry.terraform.io/-' | awk -F "[" '{print $2}' | sed 's/.$//')
|
||||
printf '\n'
|
||||
echo_and_run "providers=$(terraform providers | grep 'registry.terraform.io/-' | awk -F '[' '{print $2}' | sed 's/.$//')"
|
||||
for provider in $providers; do
|
||||
correct_provider="${provider//-/hashicorp}"
|
||||
echo "executing"
|
||||
echo "terraform state replace-provider -auto-approve $provider $correct_provider"
|
||||
terraform state replace-provider -auto-approve "$provider" "$correct_provider"
|
||||
echo_and_run 'terraform state replace-provider -auto-approve "$provider" "$correct_provider"'
|
||||
done
|
||||
printf '\n'
|
||||
|
||||
terraform $terraform_action $additional_terraform_options
|
||||
echo_and_run "terraform $terraform_action $additional_terraform_options"
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -xe
|
||||
set -e
|
||||
|
||||
additional_terraform_options=""
|
||||
function echo_and_run {
|
||||
echo "Running command: $*"
|
||||
eval "$*"
|
||||
}
|
||||
|
||||
echo_and_run 'additional_terraform_options=""'
|
||||
|
||||
terraform_action=apply
|
||||
additional_terraform_options="${additional_terraform_options} -auto-approve"
|
||||
echo_and_run 'additional_terraform_options="${additional_terraform_options} -auto-approve"'
|
||||
|
||||
|
||||
terraform init
|
||||
terraform workspace select aps1.np.navi-gi.in || terraform workspace new aps1.np.navi-gi.in
|
||||
terraform $terraform_action $additional_terraform_options
|
||||
echo_and_run "terraform init"
|
||||
echo_and_run "terraform workspace select aps1.np.navi-gi.in || terraform workspace new aps1.np.navi-gi.in"
|
||||
echo_and_run "terraform $terraform_action $additional_terraform_options"
|
||||
|
||||
@@ -1,25 +1,23 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -xe
|
||||
set -e
|
||||
function echo_and_run {
|
||||
echo "Running command: $*"
|
||||
eval "$*"
|
||||
}
|
||||
|
||||
additional_terraform_options=""
|
||||
echo_and_run 'additional_terraform_options=""'
|
||||
|
||||
terraform_action=apply
|
||||
additional_terraform_options="${additional_terraform_options} -auto-approve"
|
||||
echo_and_run 'additional_terraform_options="${additional_terraform_options} -auto-approve"'
|
||||
|
||||
|
||||
terraform init
|
||||
terraform workspace select aps1.np.navi-gi.in || terraform workspace new aps1.np.navi-gi.in
|
||||
echo_and_run "terraform init"
|
||||
echo_and_run "terraform workspace select aps1.np.navi-gi.in || terraform workspace new aps1.np.navi-gi.in"
|
||||
|
||||
providers=$(terraform providers | grep 'registry.terraform.io/-' | awk -F "[" '{print $2}' | sed 's/.$//')
|
||||
printf '\n'
|
||||
echo_and_run "providers=$(terraform providers | grep 'registry.terraform.io/-' | awk -F '[' '{print $2}' | sed 's/.$//')"
|
||||
for provider in $providers; do
|
||||
correct_provider="${provider//-/hashicorp}"
|
||||
echo "executing"
|
||||
echo "terraform state replace-provider -auto-approve $provider $correct_provider"
|
||||
terraform state replace-provider -auto-approve "$provider" "$correct_provider"
|
||||
echo_and_run 'terraform state replace-provider -auto-approve "$provider" "$correct_provider"'
|
||||
done
|
||||
printf '\n'
|
||||
|
||||
|
||||
terraform $terraform_action $additional_terraform_options
|
||||
echo_and_run "terraform $terraform_action $additional_terraform_options"
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -xe
|
||||
set -e
|
||||
|
||||
function echo_and_run {
|
||||
echo "Running command: $*"
|
||||
eval "$*"
|
||||
}
|
||||
|
||||
|
||||
function state_migration() {
|
||||
# remove option group from terraform state as option group api is removed by aws for postgres and we can't delete option group as its used by snapshot.
|
||||
@@ -14,30 +20,26 @@ function state_migration() {
|
||||
}
|
||||
|
||||
additional_terraform_options=""
|
||||
additional_terraform_options="${additional_terraform_options} -auto-approve"
|
||||
echo_and_run 'additional_terraform_options="${additional_terraform_options} -auto-approve"'
|
||||
|
||||
|
||||
terraform init
|
||||
terraform workspace select aps1.np.navi-gi.in || terraform workspace new aps1.np.navi-gi.in
|
||||
echo_and_run "terraform init"
|
||||
echo_and_run "terraform workspace select aps1.np.navi-gi.in || terraform workspace new aps1.np.navi-gi.in"
|
||||
|
||||
providers=$(terraform providers | grep 'registry.terraform.io/-' | awk -F "[" '{print $2}' | sed 's/.$//')
|
||||
printf '\n'
|
||||
echo_and_run "providers=$(terraform providers | grep 'registry.terraform.io/-' | awk -F '[' '{print $2}' | sed 's/.$//')"
|
||||
for provider in $providers; do
|
||||
if echo "$provider" | grep -q "postgres"; then
|
||||
correct_provider="${provider//-/cyrilgdn}"
|
||||
else
|
||||
correct_provider="${provider//-/hashicorp}"
|
||||
fi
|
||||
echo "executing"
|
||||
echo "terraform state replace-provider -auto-approve $provider $correct_provider"
|
||||
terraform state replace-provider -auto-approve "$provider" "$correct_provider"
|
||||
echo_and_run 'terraform state replace-provider -auto-approve "$provider" "$correct_provider"'
|
||||
done
|
||||
printf '\n'
|
||||
terraform state list | grep 'module.rds.module.postgres_db.postgresql_database.this' && terraform state rm 'module.rds.module.postgres_db.postgresql_database.this'
|
||||
echo_and_run "(terraform state list | grep 'module.rds.module.postgres_db.postgresql_database.this' && terraform state rm 'module.rds.module.postgres_db.postgresql_database.this') || true"
|
||||
state_migration
|
||||
terraform_action=apply
|
||||
terraform $terraform_action -target=module.rds.data.aws_subnet_ids.command_private_subnets -target=module.rds.data.aws_subnets.command_private_subnets $additional_terraform_options
|
||||
terraform $terraform_action -target=module.rds.module.rds_instance -target=module.rds.module.rds_instance_replica $additional_terraform_options
|
||||
terraform $terraform_action -target=module.rds.module.postgres_db $additional_terraform_options
|
||||
echo_and_run "terraform_action=apply"
|
||||
echo_and_run "terraform $terraform_action -target=module.rds.data.aws_subnet_ids.command_private_subnets -target=module.rds.data.aws_subnets.command_private_subnets $additional_terraform_options"
|
||||
echo_and_run "terraform $terraform_action -target=module.rds.module.rds_instance -target=module.rds.module.rds_instance_replica $additional_terraform_options"
|
||||
echo_and_run "terraform $terraform_action -target=module.rds.module.postgres_db $additional_terraform_options"
|
||||
|
||||
# TODO: remove -target=module.rds.data.aws_subnet_ids.command_private_subnets once terraform rds migration(specific storage_type for rds -> gp3) is complete [7 September 2023]
|
||||
|
||||
@@ -91,7 +91,7 @@ EOF
|
||||
}
|
||||
|
||||
check_lag_status() {
|
||||
LAG_STATUS_QUERY="SELECT ${slot_name}, restart_lsn - '0/0' AS lsn_on_rs, pg_current_wal_lsn() - '0/0' AS curr_wal_lsn, pg_wal_lsn_diff(pg_current_wal_lsn(), restart_lsn) AS lsn_lag, active FROM pg_replication_slots"
|
||||
LAG_STATUS_QUERY="SELECT slot_name, restart_lsn - '0/0' AS lsn_on_rs, pg_current_wal_lsn() - '0/0' AS curr_wal_lsn, pg_wal_lsn_diff(pg_current_wal_lsn(), restart_lsn) AS lsn_lag, active FROM pg_replication_slots"
|
||||
|
||||
while true; do
|
||||
lag=$(
|
||||
@@ -108,11 +108,11 @@ print(lag)
|
||||
EOF
|
||||
)
|
||||
|
||||
if [ "${lag}" -le 10 ]; then
|
||||
echo "Lag has become 0, proceeding ahead"
|
||||
if [ "${lag}" -le 10000 ]; then
|
||||
echo "Lag has become less than 10000, proceeding ahead"
|
||||
break
|
||||
else
|
||||
echo "Lag has not become 0, waiting"
|
||||
echo "Lag has not become 10000, waiting"
|
||||
sleep 10
|
||||
fi
|
||||
done
|
||||
@@ -150,6 +150,10 @@ EOF
|
||||
}
|
||||
|
||||
parse_connector_config
|
||||
if [ $? != 0 ]; then
|
||||
echo "Could not parse connector config, exiting"
|
||||
exit 0
|
||||
fi
|
||||
set_database_in_read_only
|
||||
wait_untill_database_ready
|
||||
#-----------------------------------------DATABASE is considered ready after this------------
|
||||
|
||||
21
testdata/m1_basic/expected_output/aws-roles-tf/deploy.sh
vendored
Executable file
21
testdata/m1_basic/expected_output/aws-roles-tf/deploy.sh
vendored
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
|
||||
# exit when any command fails
|
||||
set -e
|
||||
|
||||
additional_terraform_options=""
|
||||
additional_kube_options=""
|
||||
|
||||
terraform_action=${1:-apply}
|
||||
if [ $terraform_action == "apply" ];then
|
||||
additional_terraform_options="${additional_terraform_options} -auto-approve"
|
||||
else
|
||||
additional_kube_options="${additional_kube_options} --dry-run"
|
||||
fi
|
||||
|
||||
terraform init
|
||||
terraform workspace select nonprod.np.navi-tech.in || terraform workspace new nonprod.np.navi-tech.in
|
||||
terraform $terraform_action $additional_terraform_options
|
||||
|
||||
kubectl config use-context ${CLUSTER}
|
||||
kubectl apply -f foo-navi-service-dev.yaml -n ${NAMESPACE} $additional_kube_options
|
||||
17
testdata/m1_basic/expected_output/aws-roles-tf/main.tf
vendored
Executable file
17
testdata/m1_basic/expected_output/aws-roles-tf/main.tf
vendored
Executable file
@@ -0,0 +1,17 @@
|
||||
terraform {
|
||||
backend "s3" {
|
||||
bucket = "navi-bank-terraform-nonprod-state"
|
||||
region = "ap-south-1"
|
||||
key = "service-iam-roles"
|
||||
workspace_key_prefix = "iamroles/dev/foo-navi-service"
|
||||
profile = "nonprod"
|
||||
acl = "bucket-owner-full-control"
|
||||
}
|
||||
}
|
||||
|
||||
module "iam-role" {
|
||||
source = "git::ssh://git@github.cmd.navi-tech.in/navi-infra/iam-roles.git?ref=cef39cc18b5dd3095cf6969dabfe1cfe09500390"
|
||||
environment = "dev"
|
||||
service_role = {"policies":[{"actions":["s3:GetObject","s3:PutObject"],"resource":"arn:aws:s3:::navi-e3e2a9bfd88566b05001b02a3f51d286/*"},{"actions":["s3:GetObject","s3:PutObject"],"resource":"*"},{"actions":["sns:Publish","sns:SetSMSAttributes"],"resource":"arn:aws:s3:::arn:aws:s3:::test-bucket-to-be-deleted/*"}]}
|
||||
role_name = "foo-navi-service"
|
||||
}
|
||||
15
testdata/m1_basic/expected_output/aws-s3-bucket-tf/deploy.sh
vendored
Executable file
15
testdata/m1_basic/expected_output/aws-s3-bucket-tf/deploy.sh
vendored
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
# exit when any command fails
|
||||
set -e
|
||||
|
||||
additional_terraform_options=""
|
||||
terraform_action=${1:-apply}
|
||||
|
||||
if [ $terraform_action == "apply" ];then
|
||||
additional_terraform_options="${additional_terraform_options} -auto-approve"
|
||||
fi
|
||||
|
||||
terraform init
|
||||
terraform workspace select nonprod.np.navi-tech.in || terraform workspace new nonprod.np.navi-tech.in
|
||||
terraform $terraform_action $additional_terraform_options
|
||||
16
testdata/m1_basic/expected_output/aws-s3-bucket-tf/main.tf
vendored
Executable file
16
testdata/m1_basic/expected_output/aws-s3-bucket-tf/main.tf
vendored
Executable file
@@ -0,0 +1,16 @@
|
||||
terraform {
|
||||
backend "s3" {
|
||||
bucket = "navi-bank-terraform-nonprod-state"
|
||||
region = "ap-south-1"
|
||||
key = "s3-buckets"
|
||||
workspace_key_prefix = "s3-buckets/dev/foo-navi-service"
|
||||
profile = "nonprod"
|
||||
acl = "bucket-owner-full-control"
|
||||
}
|
||||
}
|
||||
|
||||
module "s3-buckets" {
|
||||
source = "git::ssh://git@github.cmd.navi-tech.in/navi-infra/aws-s3-bucket.git?ref=fd40ccc2a8f4a97029612e618b9d09902ceecfe3"
|
||||
s3_buckets = [{"anonymizedBucketName":"navi-bucket-test-1","bucketTag":"customer-uploads","lifecycleRules":null},{"anonymizedBucketName":"navi-bucket-test-2","bucketTag":"document-uploads","lifecycleRules":[{"expiration":{"days":1,"storageClass":""}}]}]
|
||||
environment = "dev"
|
||||
}
|
||||
17
testdata/m1_basic/expected_output/rds-tf/deploy.sh
vendored
Executable file
17
testdata/m1_basic/expected_output/rds-tf/deploy.sh
vendored
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
additional_terraform_options=""
|
||||
terraform_action=${1:-apply}
|
||||
|
||||
if [ $terraform_action == "apply" ];then
|
||||
additional_terraform_options="${additional_terraform_options} -auto-approve"
|
||||
fi
|
||||
|
||||
terraform init
|
||||
terraform workspace select nonprod.np.navi-tech.in || terraform workspace new nonprod.np.navi-tech.in
|
||||
terraform $terraform_action -target=module.rds.data.aws_subnet_ids.command_private_subnets $additional_terraform_options
|
||||
terraform $terraform_action -target=module.rds.module.rds_instance $additional_terraform_options
|
||||
terraform $terraform_action -target=module.rds.module.rds_instance_replica $additional_terraform_options
|
||||
terraform $terraform_action -target=module.rds.module.postgres_db $additional_terraform_options
|
||||
57
testdata/m1_basic/expected_output/rds-tf/main.tf
vendored
Executable file
57
testdata/m1_basic/expected_output/rds-tf/main.tf
vendored
Executable file
@@ -0,0 +1,57 @@
|
||||
terraform {
|
||||
backend "s3" {
|
||||
bucket = "navi-bank-terraform-command-state"
|
||||
region = "ap-south-1"
|
||||
key = "rds"
|
||||
workspace_key_prefix = "rds-states/foo-service"
|
||||
profile = "cmd"
|
||||
acl = "bucket-owner-full-control"
|
||||
}
|
||||
}
|
||||
|
||||
module "rds" {
|
||||
source = "git::ssh://git@github.cmd.navi-tech.in/navi-infra/rds.git?ref=1fc10877a1d9d009ca892208f7f89f669e7634cc"
|
||||
environment = "dev"
|
||||
instance_name = "foo-service"
|
||||
password = "foo_service_password"
|
||||
user = "foo_service_user"
|
||||
name = "foo"
|
||||
|
||||
monitoring_password = ""
|
||||
monitoring_user = ""
|
||||
|
||||
databases = ["foo_service"]
|
||||
database_tags = {
|
||||
Team = "Infra"
|
||||
medici-app = "foo-navi-service"
|
||||
medici-owner = "Infra"
|
||||
medici-environment = "dev"
|
||||
}
|
||||
|
||||
team = "Infra"
|
||||
size = 7
|
||||
db_extensions = ["pgcrypto"]
|
||||
readonly_user = "foo_readonly_user"
|
||||
readonly_password = "foo_readonly_password"
|
||||
backup_retention_period = 7
|
||||
multi_az = true
|
||||
read_replica_instance_class = "db.t3.micro"
|
||||
read_replica_performance_insights_enabled = true
|
||||
parameters = [
|
||||
{
|
||||
name = "rds.logical_replication"
|
||||
value = "1"
|
||||
apply_method = "pending-reboot"
|
||||
}
|
||||
]
|
||||
cpu_utilization_alarm_threshold = "70"
|
||||
cpucredit_balance_alarm_threshold = "120"
|
||||
burst_balance_alarm_threshold = "85"
|
||||
db_connections_alarm_threshold = "200"
|
||||
queue_depth_alarm_threshold = "20"
|
||||
free_storage_space_percent = 90
|
||||
freeable_memory_threshold = 150
|
||||
read_latency_alarm_threshold = "0.5"
|
||||
write_latency_alarm_threshold = "0.5"
|
||||
|
||||
}
|
||||
74
testdata/m1_basic/sample_infra_manifest.json
vendored
Normal file
74
testdata/m1_basic/sample_infra_manifest.json
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
{
|
||||
"extraResources": {
|
||||
"environment": "dev",
|
||||
"database": {
|
||||
"instanceName": "foo-service",
|
||||
"user": "foo_service_user",
|
||||
"password": "foo_service_password",
|
||||
"sizeInGb": 7,
|
||||
"dbNames": ["foo_service"],
|
||||
"dbExtensions": ["pgcrypto"],
|
||||
"readonlyUser": "foo_readonly_user",
|
||||
"readonlyPassword": "foo_readonly_password",
|
||||
"applyImmediately": false,
|
||||
"performanceInsightsEnabled": false,
|
||||
"readReplica": {
|
||||
"awsInstanceClass": "db.t3.micro",
|
||||
"performanceInsightsEnabled": true
|
||||
},
|
||||
"parameters": {
|
||||
"rds.logical_replication": "1"
|
||||
},
|
||||
"rdsAlertThresholds": {
|
||||
"cpuUtilization": 70,
|
||||
"cpuCreditBalance": 120,
|
||||
"burstBalance": 85,
|
||||
"dbConnections": 200,
|
||||
"queueDepth": 20,
|
||||
"freeStorageSpacePercent": 90,
|
||||
"freeMemoryTooLowInMB": 150,
|
||||
"readLatency": 0.5,
|
||||
"writeLatency": 0.5
|
||||
}
|
||||
},
|
||||
"aws_access": {
|
||||
"policies": [
|
||||
{
|
||||
"actions": ["s3:GetObject", "s3:PutObject"],
|
||||
"resource": "arn:aws:s3:::navi-e3e2a9bfd88566b05001b02a3f51d286/*"
|
||||
},
|
||||
{
|
||||
"actions": ["s3:GetObject", "s3:PutObject"],
|
||||
"resource": "*"
|
||||
},
|
||||
{
|
||||
"resource": "arn:aws:s3:::arn:aws:s3:::test-bucket-to-be-deleted/*",
|
||||
"actions": ["sns:Publish", "sns:SetSMSAttributes"]
|
||||
}
|
||||
]
|
||||
},
|
||||
"s3_buckets": [
|
||||
{
|
||||
"anonymizedBucketName": "navi-bucket-test-1",
|
||||
"bucketTag": "customer-uploads"
|
||||
},
|
||||
{
|
||||
"anonymizedBucketName": "navi-bucket-test-2",
|
||||
"bucketTag": "document-uploads",
|
||||
"lifecycleRules": [
|
||||
{
|
||||
"expiration": {
|
||||
"days": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"team": {
|
||||
"name": "Infra"
|
||||
},
|
||||
"deployment": {
|
||||
"name": "foo"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user