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

data aws_instance create list based on resource count query returned no results #10502

Open
DiegoTc opened this issue Oct 14, 2019 · 2 comments
Labels
service/ec2 Issues and PRs that pertain to the ec2 service. service/elb Issues and PRs that pertain to the elb service. waiting-response Maintainers are waiting on response from community or contributor.

Comments

@DiegoTc
Copy link

DiegoTc commented Oct 14, 2019

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

Terraform v0.12.10

Affected Resource(s)

*provider.aws v2.32.0

Terraform Configuration Files

resource "aws_instance" "one" {
  instance_type = "${var.lc_instance_type}"
  ami           = "${var.dev_ami}"
  count         = "${var.instance_count}"
  tags = {
    Name = "id"
  }
}

data "aws_instances" "read-ec2" {
  instance_tags= {
    Name = "${var.name_prefix}-id"
  }
}

resource "aws_elb" "loadbalancer" {
  instances = ["${data.aws_instances.read-ec2.ids}"]

  listener {
    ...
  }
}

Debug Output

Error: Your query returned no results. Please change your search criteria and try again.

  on modules/ec2/main.tf line 57, in data "aws_instances" "read-ec2":
  57: data "aws_instances" "read-ec2" {

Panic Output

Expected Behavior

I need to place a list of EC2 instances for the load balancer. Instead of creating instance by instance, I'm using count for the creation. For getting the list of instances created, I'm using data aws_instance, for getting the list of EC2 that were created.

Actual Behavior

At the moment of doing plan/apply I'm getting the error that the query return no results

Steps to Reproduce

Create multiple EC2 instances with the tags above, then execute a data provider to pull back the info.

  1. terraform apply

Important Factoids

References

  • #0000
@ghost ghost added service/ec2 Issues and PRs that pertain to the ec2 service. service/elb Issues and PRs that pertain to the elb service. labels Oct 14, 2019
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Oct 14, 2019
@github-actions
Copy link

github-actions bot commented Oct 5, 2021

Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.

If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!

@github-actions github-actions bot added the stale Old or inactive issues managed by automation, if no further action taken these will get closed. label Oct 5, 2021
@github-actions github-actions bot removed the stale Old or inactive issues managed by automation, if no further action taken these will get closed. label Oct 26, 2021
@justinretzolk
Copy link
Member

Hey @DiegoTc 👋 Thank you for taking the time to file this issue! Given that there's been a number of AWS provider releases since you initially filed it, can you confirm whether you're still experiencing this behavior?

@justinretzolk justinretzolk added waiting-response Maintainers are waiting on response from community or contributor. and removed needs-triage Waiting for first response or review from a maintainer. labels Dec 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
service/ec2 Issues and PRs that pertain to the ec2 service. service/elb Issues and PRs that pertain to the elb service. waiting-response Maintainers are waiting on response from community or contributor.
Projects
None yet
Development

No branches or pull requests

2 participants