-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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 a Firestore Document resource #3950
Add a Firestore Document resource #3950
Comments
In our use case, we use firestore for lightweight read-only application configuration, which I'd like to have checked in as code. Terraform 0.12's lets me specify that config natively, and I'd like to publish it to firestore. As a workaround, you can do this via cmdline, with all the usual caveats for doing so: locals {
customers = [
{
name = "customer1"
some = "value"
a-number = 123
}
]
}
resource "null_resource" "deploy-customer-config" {
count = length(local.customers)
triggers = {
source = jsonencode(local.customers[count.index])
}
provisioner "local-exec" {
command = <<EOF
firebase --project ${local.project} database:set --confirm /client-config/${local.customers[count.index].name} --data '${jsonencode(local.customers[count.index])}'
EOF
}
} |
The use case I have for this is we currently use Cloud Datastore to store metadata about projects we have created for our internal customers. We're trying to rebuild our existing provisioning process using Terraform, and this would make storing that metadata much less painful. |
The command line example here uses Realtime Database instead of Firestore and is therefore not really a workaround for having no Firestore Document resource. Our use-case is the same however, storing config data in Firestore for some of our more lightweight applications, as well as an admin list for some Firestore security rules. EDIT: For now I'm working around this by first deploying a Cloud Function which takes json as input and puts it into Firestore as data, which I can then pass a curl request to in a |
* Add guide on deleted principals * PR feedback, website link Signed-off-by: Modular Magician <[email protected]>
* Add guide on deleted principals * PR feedback, website link Signed-off-by: Modular Magician <[email protected]>
* Add guide on deleted principals * PR feedback, website link Signed-off-by: Modular Magician <[email protected]>
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 👉 [email protected]. Thanks! |
Community Note
Description
Add the ability to create a Firestore document using Terraform. This is also the best way to expose the creation of collections, which are created implicitly when a document is created.
New or Affected Resource(s)
Potential Terraform Configuration
References
The text was updated successfully, but these errors were encountered: