I’ve got a serverless config that deploys ok using my existing AWS credentials.
Version 1.9.0 introduced a provider.cfnRole key for AWS that allows you to specify a role to be assumed to perform deployment. We use this approach extensively for cloudfront etc. already.
However, when I put a role ARN in here I get the error:
The issue is that pass role is not intended to change accounts, just limit the permissions used when deploying (to a specific role).
You should be able to specify a profile that uses a cross-account role (see the CLI docs for more detail), as long as you don’t require MFA.
If you need MFA (like I do), you’ll need to do a “manual” STS assume role to set my local environment variables. The STS command is relatively quick, so I’ve just been wrapping my commands with this script (which requires jq):
Thanks Rowan. I was hoping to avoid that, since it is a bit fugly, but if the pass role isn’t for this use case then I shall have to assume role manually.