Skip to content
This repository has been archived by the owner on Jul 26, 2021. It is now read-only.

Add a cloudstack_template datasource #15

Closed
mcanevet opened this issue Aug 25, 2017 · 3 comments
Closed

Add a cloudstack_template datasource #15

mcanevet opened this issue Aug 25, 2017 · 3 comments

Comments

@mcanevet
Copy link
Contributor

It would be nice to have a cloudstack_template datasource that would return the latest template matching a pattern. For example:

datasource "cloudstack_template "ubuntu" {
  most_recent = true

  filter {
    name  = "name"
    value = "Ubuntu 16.04 .*"
  }
}
@svanharmelen
Copy link
Member

As discussed on Slack, I don’t think this is something that should be added to the go-cloudstack package. Instead I think you should create this logic in the data resource itself.

So just do a list of all templates and then search true them matching the names against the regex and maybe using the create date to determine which is the latest version.

I'll close this issue now since we discussed the options. Feel free to reopen or ping me again on Slack if you have further questions. Looking forward to the PR for adding this support 😉

@mcanevet
Copy link
Contributor Author

mcanevet commented Aug 25, 2017

@svanharmelen as this is the very first datasource for this provider I'll not be able to use my usual Copy Paste Replace Driven Development :-)
I'll try to figure out how to do it but it would take me a lot a time.
Do you have the skills (and time) to it quickly (at least some skeleton)?

@svanharmelen
Copy link
Member

Would be easy enough I think, but I don't have time today... Maybe next week I can whip something up, but no promises whatsoever!

You could also check out some of the data resources of other providers. They could be a good starting point I guess.

If you create a first WIP PR, we can take it from there I guess.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants