rurri / serverless-resources-env

Serverlss framework plugin, which after a deploy, fetches cloudformation resource identifiers and sets them on AWS lambdas, and creates local ./.serverless-resources-env/.<region>_<stage>_<function-name> file
MIT License
20 stars 7 forks source link

Interpolation not evaluated from serverless.yaml #15

Open lukiffer opened 5 years ago

lukiffer commented 5 years ago

This looks to be similar to #12 but I believe it's unique, and it may be working as intended, but the way our serverless.yml file is setup isn't working with the plugin:

We have environment-specific configuration values (e.g. AWS account number, region, etc.) in a separate serverless.<stage>.yml where is any of dev, stage, or prod.

In your main serverless.yml file, we're merging these into the config like:

provider:
  name: aws
  stage: ${opt:stage, 'dev'}
  runtime: python3.6
  region: ${file(./serverless.${self:provider.stage}.yml):DEFAULT_REGION}

It doesn't appear that the interpolation that serverless does is being evaluated when pulling the CloudFormation details after the deployment. The plugin exits with the following error:

Serverless: [serverless-resources-env] Looking up resources for CF Named: example-stack-dev

  Unknown Endpoint ---------------------------------------

  Inaccessible host: `cloudformation.'. This service may not be available in the `${file(./serverless.${self:provider.stage}.yml):DEFAULT_REGION}' region.