Skip to content

Commit

Permalink
updated helper scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
drobinson-moj committed May 3, 2024
1 parent aee5c7d commit 4da08fa
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 10 deletions.
14 changes: 9 additions & 5 deletions terraform/environments/nomis/scripts/all-secrets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,18 @@ profiles="corporate-staff-rostering-development
nomis-data-hub-test
nomis-data-hub-preproduction
nomis-data-hub-production
planetfm-development
planetfm-test
planetfm-preproduction
planetfm-production
oasys-development
oasys-test
oasys-preproduction
oasys-production"
oasys-production
oasys-national-reporting-development
oasys-national-reporting-test
oasys-national-reporting-preproduction
oasys-national-reporting-production
planetfm-development
planetfm-test
planetfm-preproduction
planetfm-production"

action=$1

Expand Down
14 changes: 9 additions & 5 deletions terraform/environments/nomis/scripts/all-ssm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,18 @@ profiles="corporate-staff-rostering-development
nomis-data-hub-test
nomis-data-hub-preproduction
nomis-data-hub-production
planetfm-development
planetfm-test
planetfm-preproduction
planetfm-production
oasys-development
oasys-test
oasys-preproduction
oasys-production"
oasys-production
oasys-national-reporting-development
oasys-national-reporting-test
oasys-national-reporting-preproduction
oasys-national-reporting-production
planetfm-development
planetfm-test
planetfm-preproduction
planetfm-production"

action=$1

Expand Down
54 changes: 54 additions & 0 deletions terraform/environments/nomis/scripts/all-tfstate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash
# wrapper script to perform ssm operations across all accounts

profiles="corporate-staff-rostering-development
corporate-staff-rostering-test
corporate-staff-rostering-preproduction
corporate-staff-rostering-production
hmpps-domain-services-development
hmpps-domain-services-test
hmpps-domain-services-preproduction
hmpps-domain-services-production
hmpps-oem-development
hmpps-oem-test
hmpps-oem-preproduction
hmpps-oem-production
nomis-development
nomis-test
nomis-preproduction
nomis-production
nomis-combined-reporting-development
nomis-combined-reporting-test
nomis-combined-reporting-preproduction
nomis-combined-reporting-production
nomis-data-hub-development
nomis-data-hub-test
nomis-data-hub-preproduction
nomis-data-hub-production
oasys-development
oasys-test
oasys-preproduction
oasys-production
oasys-national-reporting-development
oasys-national-reporting-test
oasys-national-reporting-preproduction
oasys-national-reporting-production
planetfm-development
planetfm-test
planetfm-preproduction
planetfm-production"

for profile in $profiles; do
[[ ${profile} =~ ^#.* ]] && continue
account=$(echo $profile | rev | cut -d- -f2- | rev)

if [[ -e tfstate/$profile/terraform.tfstate ]]; then
echo $profile: skipping as already downloaded
else
if [[ ! -d tfstate/$profile ]]; then
mkdir -p tfstate/$profile
fi
echo aws s3api get-object --bucket modernisation-platform-terraform-state --key environments/members/$account/$profile/terraform.tfstate tfstate/$profile/terraform.tfstate --profile $profile
aws s3api get-object --bucket modernisation-platform-terraform-state --key environments/members/$account/$profile/terraform.tfstate tfstate/$profile/terraform.tfstate --profile $profile
fi
done

0 comments on commit 4da08fa

Please sign in to comment.