-
Notifications
You must be signed in to change notification settings - Fork 53
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
Get VM template by regexp and most_recent #322
Comments
Thanks for the suggestion. In the AWS AMI case, the So with this regex attribute you will get an array of templates. Maybe we can add an attribute to choose what key is used to order the array? But anyway, if the |
Hi @frousselet! |
Hello, So we can think about something like this: data "opennebula_templates" "example" {
name_regex = "^myopennebula-\\d{3}"
order_by = [
"register_time",
"<second_level_order>",
# ...
]
order_direction = "DESC"
} Then you can select the first result of the array. @treywelsh, what do you think? |
This issue is stale because it has been open for 30 days with no activity and it has not the 'status: confirmed' label or it is not in a milestone. Remove the 'status: stale' label or comment, or this will be closed in 5 days. |
Hii @ghost i want to contribute to fix this issue |
Hi @Prakharkarsh1! |
Hello @Prakharkarsh1, Sorry for the late reply. This issue probably apply to other data sources. |
by Else I'm ok with @frousselet proposal, but do we need to order based on several fields ? |
I made a minimal draft implementation that works in a similar way that @frousselet proposed (it's a quickly written stuff so it's easy to make it crash, be careful) in #388. This allows something like:
The implementation store a list of templates data (don't know if all of these data are useful but I had in mind that this could be used to chose a template based on it's datas when automating stuffs). Feel free to test it and give feedback it's helpful |
Community Note
Description
It's will be good idea:
data "opennebula_template"
by regexpmost_recent
- if more than one result is returned, use the most recentIt may be done like in AWS, for example https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ami
New or Affected Resource(s)
Potential Terraform Configuration
The text was updated successfully, but these errors were encountered: