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

Allow configuring Firestore on a project with Terraform #3657

Closed
ghost opened this issue May 19, 2019 · 14 comments · Fixed by GoogleCloudPlatform/magic-modules#3646, #6629 or hashicorp/terraform-provider-google-beta#2193

Comments

@ghost
Copy link

ghost commented May 19, 2019

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment. If the issue is assigned to the "modular-magician" user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If the issue is assigned to a user, that user is claiming responsibility for the issue. If the issue is assigned to "hashibot", a community member has claimed the issue already.

Description

Adding the ability to manage Cloud Firestore resources like collections and documents. Looks like indices already exist.

New or Affected Resource(s)

#3305 added support for indices, but I'd love the ability to create collections and manage them through Terraform as well.

Potential Terraform Configuration

resource "google_firestore_collection" "my-collection" {
  project    = "my-project-name"

  name = "my-collection-name"
}
resource "google_firestore_document" "my-document" {
  project    = "my-project-name"
  collection = "my-collection-name"

  name = "my-document-name"

  fields {
    name = "foo"
    type = "string"
    value = "bar"
  }
}

References

https://cloud.google.com/firestore/docs/concepts/index-overview
#3305
https://github.com/GoogleCloudPlatform/magic-modules/issues/1578

@ghost ghost added the enhancement label May 19, 2019
@rileykarson
Copy link
Collaborator

rileykarson commented Jun 25, 2019

Hey @plebasaurus!

I don't think we can publish a google_firestore_collection resource, collections are created implicitly when you add a document to a collection and don't have a separate API.

We could add a google_firestore_document resource, but I'm curious what the usecase is for managing Firestore entries with Terraform. To me, they feel like something that should be managed by application-level code more than as infrastructure, so I'm curious if you (or anyone else reading this!) have different expectations for usage.

@racoon63
Copy link

I think a resource that would add a Firestore database in a specific mode and datastore location to a project would make sense. As @rileykarson mentioned collections and documents are created implicitly (collections will be created automatically when you add a document and didn't specified a collection) so there is no further relation to infrastructure for me either.

@rileykarson
Copy link
Collaborator

Ah, yep- project-level enablement of Firestore is something I'd like to expose, but that's not possible in the API today. I'm tracking a bug internally though, and that will be added when it's possible.

@ghost
Copy link
Author

ghost commented Jun 29, 2019

Hey @rileykarson, thanks for the response.

I guess I totally missed that creation is implicit for collections but here's what I was thinking anyway:

For google_firestore_collections, I'd like to be able to create a collection for each environment. I guess I'm considering any datastore associated with my application as part of the infrastructure all of which I'd like to manage in Terraform. Goal being the ability to re-create the full environment in a new/separate project.

I care less about documents but I guess an example use-case for google_firestore_document would help: lets say I'm managing user information in firestore, and want to add a default "test" user for integration tests on unique environments.

Ultimately, I agree with @racoon63's suggestion

@rileykarson
Copy link
Collaborator

That makes sense- I created #3950 for Firestore documents to split out the use case of initializing Firestore vs document creation, I'll rename this issue to cover initialization.

@rileykarson rileykarson changed the title Support for Google Cloud Firestore resources Allow configuring Firestore on a project with Terraform Jul 1, 2019
@hleb-albau
Copy link

Ah, yep- project-level enablement of Firestore is something I'd like to expose, but that's not possible in the API today. I'm tracking a bug internally though, and that will be added when it's possible.

Still not possible or we can try to move this issue further?

@rileykarson
Copy link
Collaborator

Still not possible. I"m watching the internal issue for support getting added, but there's been no progress.

@jaceq
Copy link
Contributor

jaceq commented Jan 21, 2020

@rileykarson any update on that? it's been a few months...

@ndeitch
Copy link

ndeitch commented Jan 21, 2020

Automated backups fits to this issue?

Firestore collection backup docs

@rileykarson
Copy link
Collaborator

@ndeitch: I'd suggest filing a new issue for that feature.

@jaceq: Still nothing, sorry!

@kurdybacha
Copy link

Any update on this? This prevents automatic project creation with datastore, does't it?

@wietsevenema
Copy link

There is alpha gcloud support for this now, but there is a bug:

When you create the app engine application from a service account, creating the firestore instance fails.

https://issuetracker.google.com/issues/148567895 (the suggestion to downgrade gcloud is wrong)

@danawillow danawillow added this to the Sprint 11 milestone Apr 6, 2020
@danawillow danawillow self-assigned this Apr 27, 2020
@danawillow danawillow modified the milestones: Sprint 11, Near-Term Goals May 11, 2020
@wietsevenema
Copy link

Hi, it looks like the issue that was causing issues for service accounts is now fixed, which makes project level enabling of Firestore possible.

https://issuetracker.google.com/issues/148567895

@danawillow danawillow assigned hashibot and unassigned danawillow Jun 11, 2020
modular-magician added a commit to modular-magician/terraform-provider-google that referenced this issue Jun 17, 2020
* Add note on why a user would want bigquery_dataset_iam

* Spacing

Signed-off-by: Modular Magician <magic-modules@google.com>
@ghost
Copy link

ghost commented Jul 18, 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 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!

@ghost ghost locked and limited conversation to collaborators Jul 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.