${file(...)} stoped to work

Hello guys, I have a gitlab-runner to deploy my projects on AWS and for some reason the command “${file(…)}” is not working into the runner… I’m getting this error message form AWS about the CloudFormation in wrong format:

undefined resource {file(config.{self:provider.stage}.json):iamRole}

I have 3 files:

  • confg.dev-test.json
  • confg.pre-prod.json
  • confg.prod.json
    All of than have the iamRole property with the correct ARN for environment.

It is working normally locally to deploy, but not on the runner.

The full line on the serverless.yml is:
role: {file(config.{self:provider.stage}.json):iamRole}

And I’m getting the correct stage, because I’m using it in order places on the same file… and I checked also, the file exists during the runner execution.

Tks a lot for help me.