diff --git a/packages/amplify-cli-core/src/customPoliciesUtils.ts b/packages/amplify-cli-core/src/customPoliciesUtils.ts index 727059f0e25..472e1dda6b4 100644 --- a/packages/amplify-cli-core/src/customPoliciesUtils.ts +++ b/packages/amplify-cli-core/src/customPoliciesUtils.ts @@ -116,7 +116,9 @@ function validateCustomPolicies(data: CustomIAMPolicies, categoryName: string, r for (const customPolicy of data) { const resources = customPolicy.Resource; const actions = customPolicy.Action; - const resourceRegex = new RegExp('arn:(aws[a-zA-Z0-9-]*):([a-zA-Z0-9\\-])+:([a-z]{2}(-gov)?-[a-z]+-\\d{1})?:(\\d{12})?:(.*)'); + const resourceRegex = new RegExp( + 'arn:(aws[a-zA-Z0-9-]*):([a-zA-Z0-9\\-])+:(([a-z]{2}|\\*)(-gov)?-[a-z-*]+-(\\d{1}|\\*)|\\*)?:(\\d{12}|\\*)?:(.*)', + ); const actionRegex = new RegExp('[a-zA-Z0-9]+:[a-z|A-Z|0-9|*]+'); const wrongResourcesRegex = []; const wrongActionsRegex = [];