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 ability to import Google Compute persistent disks #14573

Merged
merged 2 commits into from
May 30, 2017

Conversation

bashtoni
Copy link

$ make testacc TEST=./builtin/providers/google TESTARGS='-run=TestAccComputeDisk_importBasic'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/05/17 14:44:27 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/google -v -run=TestAccComputeDisk_importBasic -timeout 120m
=== RUN   TestAccComputeDisk_importBasic
--- PASS: TestAccComputeDisk_importBasic (26.42s)
PASS
ok  	github.com/hashicorp/terraform/builtin/providers/google	26.434s

Copy link
Member

@radeksimko radeksimko left a comment

Choose a reason for hiding this comment

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

Thank you for the PR and sorry for a small delay in reviewing it.

The tests are passing, I just left you 2 comments, but overall this looks good.

If you can also resolve conflicts that would be helpful. 😃

resource, e = getZonalResourceFromRegion(getDisk, region, config.clientCompute, project)

if e != nil {
return e
Copy link
Member

Choose a reason for hiding this comment

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

Is there any specific reason we cannot use err here for clarity?

if disk.SourceSnapshot != "" {
snapshotUrl := strings.Split(disk.SourceSnapshot, "/")
d.Set("snapshot", snapshotUrl[len(snapshotUrl)-1])
}
Copy link
Member

Choose a reason for hiding this comment

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

It may sound like nitpick and it may be just me, but I spent good couple of minutes trying to understand what all these changes above (with strings.Split) mean.
So just for clarity/readability I think it would help if we renamed zoneUrl to zoneUrlParts, typeUrl to typeUrlParts etc. so that it's more obvious that these variables hold slice, not a string?

@bashtoni bashtoni force-pushed the import-google-compute-disk branch from 3609c35 to 4f5a51e Compare May 30, 2017 11:05
@bashtoni
Copy link
Author

@radeksimko Reworded as suggested, fixed conflicts.

Thanks for reviewing!

@radeksimko
Copy link
Member

@bashtoni Thanks for making those changes, would you mind changing the last two variables too? i.e. imageUrl and snapshotUrl. Then I'm happy to click the big green button and 🚢 it 😃

@radeksimko radeksimko added the waiting-response An issue/pull request is waiting for a response from the community label May 30, 2017
@radeksimko radeksimko removed the waiting-response An issue/pull request is waiting for a response from the community label May 30, 2017
@radeksimko radeksimko merged commit 56fbe02 into hashicorp:master May 30, 2017
@bashtoni bashtoni deleted the import-google-compute-disk branch May 30, 2017 13:32
@ghost
Copy link

ghost commented Apr 12, 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 12, 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.

3 participants