Closed Brian969 closed 3 years ago
For reference: '\${HOME_REGION}': region, '\${GBL_REGION}': GLOBAL_REGION, '\${ACCELERATOR_NAME}': acceleratorName, '\${ACCELERATOR_PREFIX}': acceleratorPrefix, '\${ACCELERATOR_PREFIX_ND}': accelPrefixNd, '\${ACCELERATOR_PREFIX_LND}': accelPrefixNd.toLowerCase(), '\${ORG_ADMIN_ROLE}': orgAdminRole!,
#### PROBLEM1
- it failed to replace ${ORG_ADMIN_ROLE} in the SCP's - first run succeeds, second run fails due to SCP blocks.
- weird - on re-examination, problem1 may not be an issue.
#### PROBLEM 2
- double variables not properly replacing quotes
~~- "aws:RequestedRegion": "${ADDL_REGIONS_A}" replaced with: "aws:RequestedRegion": ["ca-central-1, us-east-1"]
instead of: "aws:RequestedRegion": ["ca-central-1", "us-east-1"]~~
- and this in the _C case: "aws:RequestedRegion": ["ca-central-1, us-east-1", "us-east-2", "us-west-1", "us-west-2"]
- missing two sets of quotes between ca-central-1 and us-east-1
- operator error, reformatted input file
Describe the problem you want solved
Describe the solution you'd like
Variables used by customers in SCP's and config.json/yaml that are replaced automatically during SM execution (before raw generated):
${HOME_REGION}
- automatically resolves to the SM home/installation region (i.e."ca-central-1"
) including quotes${GBL_REGION}
- hardcode to"us-east-1"
including quotes${ADDL_REGIONS_A}
,${ADDL_REGIONS_B}
,${ADDL_REGIONS_N}
including quotes - lookup from config file per below${ACCELERATOR_NAME}
- should resolve toPBMM
no quotes${ACCELERATOR_PREFIX}
- should resolve toPBMMAccel-
no quotes${ACCELERATOR_PREFIX_ND}
- should resolve toPBMMAccel
no quotes${ACCELERATOR_PREFIX_LND}
- should resolve topbmmaccel
no quotesAdd to config file:
addl_regions_a
would replace all occurrences of ${ADDL_REGIONS_A}customer-variable
, i.e.customer value
An SCP file looking like this:
would change to:
This would also be executed against the
config.json/yaml
during /raw generation - for example all occurrences ofca-central-1
could be replaced with${HOME_REGION}
, etc.Example - These lines in SCP's:
"arn:aws:iam::*:role/${ACCELERATOR_PREFIX}*",
"arn:aws:iam::*:role/${ACCELERATOR_NAME}Ops-*"
"ec2:ResourceTag/Accel-P": "${ACCELERATOR_NAME}"
"Resource": ["arn:aws:s3:::${ACCELERATOR_PREFIX_LND}-*", "arn:aws:s3:::cdktoolkit-*", "arn:aws:s3:::cf-templates-*"],
"arn:aws:ssm:*:*:parameter/${ACCELERATOR_PREFIX_ND}*",
"Resource": "arn:aws:iam::*:role/${ACCELERATOR_PREFIX}RDGW-Role",
"Resource": "arn:aws:logs:::log-group:*${ACCELERATOR_PREFIX_ND}*",
"Resource": ["arn:aws:firehose:*:*:deliverystream/${ACCELERATOR_PREFIX_ND}*", "arn:aws:kinesis:*:*:stream/${ACCELERATOR_PREFIX_ND}*"],
Would transform to these:
"arn:aws:iam::*:role/PBMMAccel-*",
"arn:aws:iam::*:role/PBMMOps-*"
"ec2:ResourceTag/Accel-P": "PBMM"
"Resource": ["arn:aws:s3:::pbmmaccel-*", "arn:aws:s3:::cdktoolkit-*", "arn:aws:s3:::cf-templates-*"],
"arn:aws:ssm:*:*:parameter/PBMMAccel*",
"Resource": "arn:aws:iam::*:role/PBMMAccel-RDGW-Role",
"Resource": "arn:aws:logs:::log-group:*PBMMAccel*",
"Resource": ["arn:aws:firehose:*:*:deliverystream/PBMMAccel*", "arn:aws:kinesis:*:*:stream/PBMMAccel*"],
(need to think about quote handling on regions - does it make sense? Should it be a string rather than an array to enable this?)
ADDITIONALLY