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 datasource digitalocean_image #13787

Merged
merged 1 commit into from
Apr 21, 2017

Conversation

roidelapluie
Copy link
Contributor

@roidelapluie roidelapluie commented Apr 19, 2017

Add a new data source for Digital Ocean that finds snapshots by name.

Signed-off-by: Julien Pivotto roidelapluie@inuits.eu

Current status: Test panics.

TODO:

  • test when 2 snapshots have the same name
  • remove snapshots in acceptance tests
  • test when no snapshot matches the query
  • Add real world example in documentation (data digitalocean_image used in digitalocean_droplet)

@roidelapluie
Copy link
Contributor Author

Current status: snapshots and droplets are not destroyed :(

@roidelapluie
Copy link
Contributor Author

current status: working, ready for review

@roidelapluie roidelapluie changed the title [WIP] Add DigitalOcean datasource digitalocean_image Add DigitalOcean datasource digitalocean_image Apr 21, 2017
Add a new data source for Digital Ocean that finds snapshots by name.

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
@stack72
Copy link
Contributor

stack72 commented Apr 21, 2017

Hi @roidelapluie

This LGTM! The acceptance tests pass too :) Nice to see a DO datasource :)

% make testacc TEST=./builtin/providers/digitalocean TESTARGS='-run=TestAccDigitalOceanImage_'                       ✭
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/04/21 16:16:24 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/digitalocean -v -run=TestAccDigitalOceanImage_ -timeout 120m
=== RUN   TestAccDigitalOceanImage_Basic
--- PASS: TestAccDigitalOceanImage_Basic (294.89s)
PASS
ok  	github.com/hashicorp/terraform/builtin/providers/digitalocean	294.913s

Paul

@stack72 stack72 merged commit c2a1e68 into hashicorp:master Apr 21, 2017
@roidelapluie
Copy link
Contributor Author

Great. Maybe the last test step could be changed by a "Cleanup" attribute at the TestCase level. This is because Terraform is not creating the snapshots in tf code, so I create them in go.

@roidelapluie roidelapluie deleted the doim branch April 21, 2017 17:25
@lfarnell
Copy link

@stack72 @roidelapluie After looking at the changes, the go files for this change are spelt wrong. Currently datasource_digitaloceal_image.go should be datasource_digitalocean_image.go. Sorry for commenting on a merged PR

roidelapluie added a commit to roidelapluie/terraform that referenced this pull request Apr 27, 2017
refs hashicorp#13787

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
radeksimko pushed a commit that referenced this pull request Apr 27, 2017
refs #13787

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
@andrewsomething
Copy link
Contributor

Just noticed this landed. I had attempted something similar in #12873 but got blocked on tests. I didn't realize this approach was an option.

The main difference between this and what I implemented is that I used the snapshots endpoint:

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

The main advantage to that is it also allows for finding volume snapshots.

@roidelapluie
Copy link
Contributor Author

roidelapluie commented Apr 28, 2017 via email

@andrewsomething
Copy link
Contributor

andrewsomething commented May 5, 2017

In retrospect, it was a simple misunderstanding on my part. I thought it would require writing a resource to take snapshots first, which didn't seem particularly useful, as opposed to creating and deleting the resources directly via calls to godo.

@ghost
Copy link

ghost commented Apr 13, 2020

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants