Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support 0.13 provider identities #255

Merged
merged 3 commits into from
Aug 7, 2020
Merged

Conversation

radeksimko
Copy link
Member

@radeksimko radeksimko commented Aug 5, 2020

This PR closes the loop on 0.13 support and closes #164

Implementation details

  • A separate simplified parser (terraform-config-inspect) is used to parse the provider identities. This might however in the near future be replaced by a dedicated version-aware parser. The aim here is just to deliver 0.13 support early and avoid the extra pressure there would be on delivering the new parser.
  • It is becoming more obvious that we'll need a stateful parser, or that we'll need to maintain the parsed AST in which we can lookup provider identities, variables, outputs, etc. etc. The existing parser is not well designed for that as it is stateless and parses configs lazily. This PR doesn't solve the problem in the most ideal way, since it introduces additional parser, therefore the same unique config will be parsed twice. It's a trade-off for bringing 0.13 support early.
  • We (re)parse the each module on initialize so we can match providers correctly. This in turn means we spend more CPU and memory during the initial discovery phase. This in turn puts more pressure to resolving Set a cap for auto-loading root modules #186
  • Provider aliases generally do not affect what schema will be available, there will always be at most 1 version of a provider (as identified by its identity) and mapping of provider names to identities is done in terraform.required_providers. This cannot be overridden by aliases. Aliases only affect configuration differences, not schema. This is why the parser can ignore them at this stage.
  • Changes were introduced to the Filesystem interface to make it compatible with tfconfig.FS and to reflect that files may be changed by client, but not saved to disk and the in-memory copy needs to be prioritized as per LSP.
    • Allow parsing module from any filesystem terraform-config-inspect#49 introduces the relevant FS interface to upstream in terraform-config-inspect in a backwards-compatible way
    • in theory all FS operations could use the new FS interface, but the PR is only introducing it to the parser as that's where it is critical and also well implemented/configured client should only be sending updates for *.tf files, not module manifests nor plugin lock files - so these will be read from the disk in the foreseeable future anyway.

@radeksimko radeksimko added bug Something isn't working terraform/0.13 enhancement New feature or request and removed bug Something isn't working labels Aug 5, 2020
@radeksimko radeksimko added this to the v0.6.0 milestone Aug 5, 2020
@radeksimko radeksimko force-pushed the f-support-013-identities branch 9 times, most recently from f81ce77 to 65eabc1 Compare August 6, 2020 11:23
@radeksimko radeksimko force-pushed the f-support-013-identities branch 2 times, most recently from 1f3c50d to 736b92c Compare August 6, 2020 12:17
@radeksimko radeksimko force-pushed the f-support-013-identities branch 2 times, most recently from 16fa011 to 7e4dd27 Compare August 6, 2020 12:29
@radeksimko radeksimko marked this pull request as ready for review August 6, 2020 13:16
@radeksimko radeksimko requested a review from a team August 6, 2020 13:16
Copy link
Contributor

@appilon appilon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@radeksimko radeksimko merged commit 7bd982c into master Aug 7, 2020
@radeksimko radeksimko deleted the f-support-013-identities branch August 7, 2020 05:16
@ghost
Copy link

ghost commented Sep 6, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the context necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Sep 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request terraform/0.13
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support provider aliases and 0.13 identities
2 participants