generated from ministryofjustice/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aee5c7d
commit 4da08fa
Showing
3 changed files
with
72 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |