@@ -139,12 +139,29 @@ def get_resource_parameters(event):
139139 repo .SOLUTIONS_DIR = f"/tmp/aws-security-reference-architecture-examples-{ repo .REPO_BRANCH } /aws_sra_examples/solutions"
140140
141141 sts .CONFIGURATION_ROLE = "sra-execution"
142+ governed_regions_param = ssm_params .get_ssm_parameter (ssm_params .MANAGEMENT_ACCOUNT_SESSION , REGION , "/sra/regions/customer-control-tower-regions" )
143+ if governed_regions_param [0 ] is True :
144+ GOVERNED_REGIONS = governed_regions_param [1 ]
145+ LOGGER .info (f"Successfully retrieved the SRA governed regions parameter: { GOVERNED_REGIONS } " )
146+ else :
147+ LOGGER .info ("Error retrieving SRA governed regions ssm parameter. Is the SRA common prerequisites solution deployed?" )
148+ raise ValueError ("Error retrieving SRA governed regions ssm parameter. Is the SRA common prerequisites solution deployed?" ) from None
142149
143- GOVERNED_REGIONS = ssm_params .get_ssm_parameter (ssm_params .MANAGEMENT_ACCOUNT_SESSION , REGION , "/sra/regions/customer-control-tower-regions" )
144-
145- SECURITY_ACCOUNT = ssm_params .get_ssm_parameter (ssm_params .MANAGEMENT_ACCOUNT_SESSION , REGION , "/sra/control-tower/audit-account-id" )
150+ security_acct_param = ssm_params .get_ssm_parameter (ssm_params .MANAGEMENT_ACCOUNT_SESSION , REGION , "/sra/control-tower/audit-account-id" )
151+ if security_acct_param [0 ] is True :
152+ SECURITY_ACCOUNT = security_acct_param [1 ]
153+ LOGGER .info (f"Successfully retrieved the SRA security account parameter: { SECURITY_ACCOUNT } " )
154+ else :
155+ LOGGER .info ("Error retrieving SRA security account ssm parameter. Is the SRA common prerequisites solution deployed?" )
156+ raise ValueError ("Error retrieving SRA security account ssm parameter. Is the SRA common prerequisites solution deployed?" ) from None
146157
147- ORGANIZATION_ID = ssm_params .get_ssm_parameter (ssm_params .MANAGEMENT_ACCOUNT_SESSION , REGION , "/sra/control-tower/organization-id" )
158+ org_id_param = ssm_params .get_ssm_parameter (ssm_params .MANAGEMENT_ACCOUNT_SESSION , REGION , "/sra/control-tower/organization-id" )
159+ if org_id_param [0 ] is True :
160+ ORGANIZATION_ID = org_id_param [1 ]
161+ LOGGER .info (f"Successfully retrieved the SRA organization id parameter: { ORGANIZATION_ID } " )
162+ else :
163+ LOGGER .info ("Error retrieving SRA organization id ssm parameter. Is the SRA common prerequisites solution deployed?" )
164+ raise ValueError ("Error retrieving SRA organization id ssm parameter. Is the SRA common prerequisites solution deployed?" ) from None
148165
149166 staging_bucket_param = ssm_params .get_ssm_parameter (ssm_params .MANAGEMENT_ACCOUNT_SESSION , REGION , "/sra/staging-s3-bucket-name" )
150167 if staging_bucket_param [0 ] is True :
0 commit comments