Skip to content

Commit

Permalink
Fix firestore database autoname (#2184)
Browse files Browse the repository at this point in the history
fixes #2183

Firestore database needs an all lowercase name since the API errors
otherwise.

We should likely do this for all GCP resources as it looks like quite a
few of them have this: #2164
  • Loading branch information
VenelinMartinov authored Aug 20, 2024
1 parent d6e1e12 commit 53168e9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
7 changes: 7 additions & 0 deletions provider/provider_yaml_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -920,3 +920,10 @@ func TestFirestoreFieldPermadiffRegress2166(t *testing.T) {
pt.Up()
pt.Preview(optpreview.ExpectNoChanges())
}

func TestFirestoreDatabaseAutoname(t *testing.T) {
pt := pulumiTest(t, "test-programs/firestore-db-autoname")
proj := getProject()
pt.SetConfig("gcpProj", proj)
pt.Up()
}
2 changes: 1 addition & 1 deletion provider/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -1296,7 +1296,7 @@ func Provider() tfbridge.ProviderInfo {
// Firestore resources
"google_firestore_index": {Tok: gcpResource(gcpFirestore, "Index")},
"google_firestore_document": {Tok: gcpResource(gcpFirestore, "Document")},
"google_firestore_database": {Tok: gcpResource(gcpFirestore, "Database")},
"google_firestore_database": {Tok: gcpResource(gcpFirestore, "Database"), Fields: nameField(lowercaseAutoName())},
"google_firestore_field": {
Tok: gcpResource(gcpFirestore, "Field"),
Fields: map[string]*tfbridge.SchemaInfo{
Expand Down
12 changes: 12 additions & 0 deletions provider/test-programs/firestore-db-autoname/Pulumi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: firestore-db-autoname
runtime: yaml
config:
gcpProj: string
resources:
myFirestoreDatabase:
type: gcp:firestore:Database
properties:
type: "FIRESTORE_NATIVE"
project: ${gcpProj}
locationId: "us-central1"
deletionPolicy: DELETE

0 comments on commit 53168e9

Please sign in to comment.