-
Notifications
You must be signed in to change notification settings - Fork 218
Open
Description
Hey,
On a deeper look at the changes just made in #660
Specifically on,
https://github.com/serverless-operations/serverless-step-functions/blob/master/lib/deploy/stepFunctions/compileIamRole.js#L743
Am I right to assume this will always resolve to aws, even when we are in a different partition like aws-cn or aws-eusc.
Maybe something like this is needed to ensure that it resolves to the correct partition.
function getCurrentPartition() {
// From environment variable set by deployment
if (process.env.AWS_PARTITION) {
return process.env.AWS_PARTITION;
}
// Or detect from AWS region
const region = process.env.AWS_REGION || process.env.AWS_DEFAULT_REGION;
if (region?.startsWith('cn-')) return 'aws-cn';
if (region?.startsWith('us-gov-')) return 'aws-us-gov';
return 'aws';
}
function getIamPermissions(taskStates, partition = getCurrentPartition()) {
return _.flatMap(taskStates, (state) => {
const resourceName = typeof state.Resource === 'string'
? state.Resource.replace(/\$\{AWS::Partition\}/g, partition)
: state.Resource;
switch (resourceName) {
case `arn:${partition}:states:::states:startExecution.sync`:
// ...
}
});
}
Or something more appropriate, bare in mind not able to deploy to any of these AWS Partitions as of yet so testing ourselves is difficult.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels