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.
I'm not sure if it's acceptable to create an unfinished PR, but I hit a wall and am unsure what to do to resolve it. This PR is in response to the request for an "aws_instances" data source in Issue #12376. My approach was to make the returned data have a field called "instances", which would be a list of instances with the same format as the one returned in the "aws_instance" data source.
I wanted to be able to do something like this: https://gist.github.com/artburkart/16f88b5856861d164dae4b1aeefc0724
Because I wanted it to be similar to the "aws_route_table" data source which lets you do this: https://gist.github.com/artburkart/d5dd81302179493b2ab2c23fbfcb84b8
Everything seems to work. The multiple instances are getting queried and the data sources are getting populated, but for some reason, I can't get them to attach to the "aws_instances" ResourceData object. I have a feeling the problem is in the code here: https://github.com/artburkart/terraform/blob/e7f03452ffd58fc953c0915d77e5b8551e1f70f5/builtin/providers/aws/data_source_aws_instance.go#L315-L334
In this code I tried to follow the pattern laid out in data_source_aws_route_table, but something has gone awry. Whenever I perform a
terraform apply
with the configs I've provided in this PR, I get this:For some reason,
data.aws_instances.boxes.instances
does not exist, and I'm not exactly sure why not. I'm going to keep pecking at it, but if someone could offer some guidance, it would be much appreciated. Once I figure this bug out, I'll add all the tests and docs that generally accompany a new data source.Cheers