hashicorp / terraform-provider-google

Terraform Provider for Google Cloud Platform
https://registry.terraform.io/providers/hashicorp/google/latest/docs
Mozilla Public License 2.0
2.36k stars 1.75k forks source link

Add import command for bigtable #932

Closed wmuizelaar closed 5 years ago

wmuizelaar commented 6 years ago

Terraform Version

0.11.1

Affected Resource(s)

Please list the resources as a list, for example:

Expected Behavior

I can import the resources on my tfstate

Actual Behavior

Import is not supported for resource:

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform import <resource> xxxx
Legogris commented 6 years ago

@wmuizelaar The issue description is confusing to me - is this a reference to an issue on another tracker? This is something we would like to have. @paddycarver I was considering looking into this as a first contribution and getting inside TF - anything particular that makes this a breaking change?

wmuizelaar commented 6 years ago

@Legogris I definitely copy-pasted too much - editted the description to fit better :)

rileykarson commented 6 years ago

Hey @Legogris!

For a bit of context: We don't currently support import because the (v1) API at the time that we implemented the feature didn't expose enough information to do so. It didn't have support for clusters yet, so part of what a cluster does is baked into google_bigtable_instance. There is now a v2 API that introduces clusters & it should have all the information necessary to do an import.

Cloud Bigtable is also using a different API client than most of the provider. We normally use the Go REST api clients but Cloud Bigtable is only supported by a Cloud Client Library. This means that some of the patterns in the rest of the codebase aren't very useful to reference.

It's definitely on my (personal) radar to look at our Cloud Bigtable support and bring it up to date with the v2 API, but I haven't had the time to sit down and work out how to get it there (and have no timeline/estimate for when I will unfortunately 🙁 ).


If import support is really important for you, we will gladly accept a community contribution here! I just wanted to be transparent that "Here be dragons" and that it may not be a great candidate for a first contribution. You would be working with a different client than the rest of the provider & google_bigtable_instance is an amalgam of an instance and a cluster and it may a little grungy to get all the right fields in the right place without introducing any breaking changes.

psalaberria002 commented 5 years ago

Any news on this one? We migrated all of our codebase to 0.12, and the only service we have left is Bigtable. Is there any workaround for importing a cluster?

rileykarson commented 5 years ago

Other than manual remediation of state, not really. I'm likely picking up a general goal next quarter to improve the UX for Bigtable resources, which would include import. There should be news by EOQ depending exactly what order that work falls in.

memory commented 5 years ago

about a quarter later -- any update on this?

rileykarson commented 5 years ago

This is assigned to me to complete by EOQ, I'm hoping to get to it soon after HashiConf.

rileykarson commented 5 years ago

Some fields aren't exposed in the client library that are needed to import the resource. I've made a change upstreaming one so far- once I can get https://code-review.googlesource.com/c/gocloud/+/45770 to land, I have a PR drafted locally which will add support for google_bigtable_instance.

google_bigtable_table will follow after that, I may need to expose fields upstream in the client lib for that as well.

nickmoorman commented 5 years ago

Hi @rileykarson! Just curious if you had any update on google_bigtable_table import support, and if you're also working on import functionality for google_bigtable_gc_policy.

rileykarson commented 5 years ago

I haven't gotten around to this yet- getting the library changes for google_bigtable_instance took longer than expected, and I had some time sensitive work come up. I'm hoping to finish up google_bigtable_table and hopefully google_bigtable_gc_policy within the next few weeks.

rileykarson commented 5 years ago

google_bigtable_table will have import support in 2.20.0, ~midway next week probably. Sorry for how drawn out resolving this was!

google_bigtable_gc_policy isn't currently possible to support, the client library only lets us read back a string representation of the GCPolicy. While we could modify the client again, it's less clear-cut of a modification than the change with instances/clusters.

Given that, I'm going to close out this issue based on having instance/table supported. Please open a new issue if anyone is interested in import support for GCPolicy!

ghost commented 4 years ago

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!