Skip to content

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

Closed

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:

Activity

  1. changed the title [-]Multi-phase variables resolution[/-] [+]Intelligent multi-phase variables resolution[/+] on Jan 13, 2020
  2. changed the title [-]Intelligent multi-phase variables resolution[/-] [+]Improve variables resolution phases[/+] on Apr 2, 2020
  3. changed the title [-]Improve variables resolution phases[/-] [+]For some core properties variables are not resolved as expected[/+] on Apr 30, 2020
  4. added
    bug/design
    and removed on Apr 30, 2020
  5. changed the title [-]For some core properties variables are not resolved as expected[/-] [+]For some core properties (e.g. `provider` and `plugins`) variables are not resolved as expected[/+] on May 14, 2020
  6. medikoo commented on Apr 12, 2021

    @medikoo
    ContributorAuthor

    Closing as it was addressed with #8364

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug/designcat/designcat/variable

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions