Passing accountId

Hey, I’m looking to template on accountId for my role and cfnRole (along with other things).

I’ve tried

provider:
  role: arn:aws:iam::${AWS::AccountId}:role/execution-role-name
  cfnRole: arn:aws:iam::${AWS::AccountId}:role/deploy-role-name

but I’ve been greeted with a:

Serverless: Updating Stack...
 
 Serverless Error ----------------------------------------
 
  Cross-account pass role is not allowed.

and this error doesn’t otherwise happen.

What is going on? Why would this be triggered by using the accountId here? I’m pretty confident that this is being deployed by the same account.

I’ve also tried using the pseudo parameters plugin to do similar and achieved similar issues.

I assume that this is probably due to this not being run in cloud formation or something?

I there no way to say “template this with the accountId of the user running this deploy?”

Hey @cleartrevorvossberg :wave: I’ve merged today a PR that will allow to reference and resolve accountId in all places in your config: Add support for `aws:region` and `aws:accountId` variables by pgrzesik · Pull Request #9662 · serverless/serverless · GitHub

It should be released either today or tomorrow

Thanks! that looks great. What version would that end up in or how would I be able to use those changes?

It will be available with 2.50.0 that will be released in ~ 1 hour.