-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
New Data Source: aws_instances #2266
Conversation
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.
👍 nit/questions likely carryover from the original PR, I won't block it as-is
aws/data_source_aws_instances.go
Outdated
|
||
var instanceIds, privateIps, publicIps []string | ||
err := conn.DescribeInstancesPages(params, func(resp *ec2.DescribeInstancesOutput, isLast bool) bool { | ||
// loop through reservations, and remove terminated instances, populate instance slice |
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.
Option: could always use a filter
on instance-state-name
and append user filters to it, to save you this looping and possibly entire API pagination calls
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.
Ha, very valid point, I'll change that 👍
aws/data_source_aws_instances.go
Outdated
|
||
log.Printf("[DEBUG] Found %d instances via given filter", len(instanceIds)) | ||
|
||
d.SetId(time.Now().String()) |
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.
Optional/question: is there an advantage or reason to use time.Now()
here for the id
instead of using resource.UniqueId()?
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.
UniqueID sounds safer, I'll change it - good point.
f0c44ac
to
ccf26c7
Compare
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Closes #574
Replaces hashicorp/terraform#12856
Test Results