-
Notifications
You must be signed in to change notification settings - Fork 10k
query: generate unique resource identifiers for results of expanded list resources #37681
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
base: sams/validate-query-command
Are you sure you want to change the base?
query: generate unique resource identifiers for results of expanded list resources #37681
Conversation
8a16803
to
53a7fd4
Compare
53a7fd4
to
f9e4d0d
Compare
InstanceAddrs []addrs.AbsResourceInstance | ||
} | ||
|
||
func (t *ResourceCountTransformer) Transform(g *Graph) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is leaning on some very old code that probably should have been refactored out (notice it only mentions count
, as if there's no other possibility 😆) I wonder if there's another was to get a generated value here without having to hide it in the NodeAbstractResourceInstance
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The config generation abstraction for instances from a list
resource is genconfig.ResourceListElement
. Since config generation is the only place where this index value has meaning, perhaps we can insert it there while iterating over the list states?
// override is set by the graph itself, just before this node executes. | ||
override *configs.Override | ||
|
||
// expansionEnum tracks the index of the resource instance within the resource. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't really track the index, it only happens to coincide with the order that the expansion addresses were generated by the Expander
(the fact they are even sorted isn't guaranteed, it's just there to make consistent tests easier)
This fixes a bug where duplicate resource addresses are generated for the results of each instance of an expanded list resource. While
AbsResourceInstance
is indeed unique, the uniqueness key is not a valid hcl identifier.Target Release
1.15.x
Rollback Plan
Changes to Security Controls
Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.
CHANGELOG entry