-
Notifications
You must be signed in to change notification settings - Fork 24
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
Introduce support for self.*
references
#163
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 tasks
Since appropriate address now depends on the position of the origin (which is pointing to the target), this change reflects that.
radeksimko
force-pushed
the
f-self-refs
branch
from
November 24, 2022 12:30
3286f22
to
56802f1
Compare
dbanck
approved these changes
Nov 24, 2022
6 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Architecture Background
One vs Two schema flags (targets vs origins)
Originally the hope/plan was to have just a single "flag" in the schema under the
Extensions
-SelfRef: true
, just like we have for Count and ForEach and will have for dynamic blocks. However, it turns out that isn't most practical. This is because we collect reference targets with the appropriate addresses separately from origins and because we would have to traverse through the rest of a potentially deeply nested and long block, to find out whether a particular target needs a localself
address or not.So we instead introduce the additional
DependentBodySelfRef: true
which implies that any attributes and blocks within the body will be collected as a target with an additionalself.*
local address. This will then be enabled for Terraform within theresource
anddata
blocks and allows us to do the target collection without knowing whether that address is needed or not in the rest of the block.Contextual Address
Since reference targets can now have both local (
LocalAddr
) and "absolute" (Addr
) address, this needs to be considered when rendering the address in completion, hover and elsewhere. In Terraform,self.*
addresses are relevant underprovisioner
,connection
and some other blocks, and the assumption is that these refer to the outermost block/body, i.e.resource
block.UX Impact
Completion
Hover
Go-to-*
Semantic Token Highlighting