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

Build EvalContext as the root module #742

Merged
merged 2 commits into from May 10, 2020

Conversation

wata727
Copy link
Member

@wata727 wata727 commented May 9, 2020

Fixes #733
Closes #736

I found that I was making a big mistake in building the eval context. According to the documentation, the terraform.Evaluator's Config field should always be the root module, not the individual modules.
https://github.com/hashicorp/terraform/blob/v0.12.24/terraform/evaluate.go#L34-L35

The current implementation builds an Evaluator for each module and each module's evaluation context is treated as the root module. So, the values of path.root and path.module will always be the same.

This PR makes path.root to be evaluated correctly by building Evaluator and EvalContext for the root module.

@wata727 wata727 force-pushed the build_eval_context_with_root_module branch from fc9103a to 737490a Compare May 9, 2020 13:50
@wata727 wata727 merged commit 76955b2 into master May 10, 2020
@wata727 wata727 deleted the build_eval_context_with_root_module branch May 10, 2020 06:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Fails to find file in root directory from a module
1 participant