Skip to content

For some core properties (e.g. provider and plugins) variables are not resolved as expected #7207

@medikoo

Description

@medikoo

Currently variables configuration is setup as limited two-phase resolution. Where in first phase we resolve some strict set of variables (crucial for some variable resolvers), and immediately afterwards follow with all others.

What's problematic both phases happen after some configuration was already consumed (e.g. plugins loaded, package configuration copied), therefore some parts of a configuration cannot e.g. be secluded to outer files, as it won't be resolved on time (see #7203).

Probably best method would be to resolve variables with following phases:

  1. Right after first read of config. Resolve file and self resolvers (which do not depend on other resolvers). (JS file resolvers may take some meta input, e.g. CLI params, as proposed here: Variables: Pass CLI params to JS file resolvers #4143)
  2. Ensure environment variables are resolved from .env files (upcoming with Support loading env variables from .env files #7907)
  3. Resolve env and remaining file self resolvers (which do not depend on other resolvers)
  4. Initialize Serverless instance with registered plugins
  5. For each variable resolver ensure properties it depends on are fully resolved (e.g. resolvers that reach out to AWS services, demand region, profile and credentials be fully resolved for it to work)
  6. Resolve all remaining variables

This should be achieved together with process flow refactor and will most likely mean a near complete rewrite of variables resolution logic


Other variable resolution issues that should be addressed when refactoring:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions