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

add digitalocean_images datasource #394

Merged
merged 7 commits into from
Mar 10, 2020

Conversation

tdyas
Copy link
Contributor

@tdyas tdyas commented Mar 7, 2020

Use the datalist library to add a digitalocean_images datasource. Also update the digitalocean_image datasource to use the new common code.

This should supersede https://github.com/terraform-providers/terraform-provider-digitalocean/pull/79, although an open question is whether there should be a type attribute like in the DO API for applications and distributions.

@ghost ghost added the size/XL label Mar 7, 2020
and expand `name` to all images, set `private = true` to search only user images
@ghost ghost added the documentation label Mar 7, 2020
@tdyas
Copy link
Contributor Author

tdyas commented Mar 7, 2020

Open question: should distributions and application be broken out somehow in either or both the digitalocean_image and digitalocean_images datasources? (Trying to see if that idea in https://github.com/terraform-providers/terraform-provider-digitalocean/pull/79 should be pulled forward.)

Copy link
Member

@andrewsomething andrewsomething left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! Two small changes needed to fix up the existing tests.

should distributions and application be broken out somehow

One slightly confusing thing to note here is that the type query parameter doesn't actually map onto the type attribute returned by the API:

Describes the kind of image. It may be one of "snapshot", "backup", or "custom". This specifies whether an image is a user-generated Droplet snapshot, automatically created Droplet backup, or a user-provided virtual machine image.

https://developers.digitalocean.com/documentation/v2/#images

So it would probably still be helpful to have an argument that chooses godo.Images.ListUser, godo.Images.ListApplication, godo.Images.ListDistribution. That also brings some performance gains. Doesn't necessarily need to block this PR

@tdyas
Copy link
Contributor Author

tdyas commented Mar 9, 2020

So it would probably still be helpful to have an argument that chooses godo.Images.ListUser, godo.Images.ListApplication, godo.Images.ListDistribution. That also brings some performance. Doesn't necessarily need to block

How about source as the name of the parameter? Distinct from type but still conveys what it does.

@andrewsomething
Copy link
Member

@tdyas 👍 Sounds good!

@andrewsomething andrewsomething self-requested a review March 10, 2020 15:32
Copy link
Member

@andrewsomething andrewsomething left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 LGTM

Thank you yet again for another great contribution!

@andrewsomething andrewsomething merged commit 3db49fd into digitalocean:master Mar 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants