Skip to content

Commit 035e8ce

Browse files
committed
update terrafrom file
1 parent 711a3aa commit 035e8ce

File tree

3 files changed

+54
-3
lines changed

3 files changed

+54
-3
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,9 @@ FirebaseAppCheck/Apps/AppCheckCustomProvideApp/AppCheckCustomProvideApp/GoogleSe
156156
/Example/FirestoreSample/ui-debug.log
157157
/Example/FirestoreSample/firestore-debug.log
158158
/Example/FirestoreSample/firebase-debug.log
159+
160+
# generated Terraform docs
161+
.terraform/*
162+
.terraform.lock.hcl
163+
*.tfstate
164+
*.tfstate.*

main.tf

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
variable "project_info" {}
1+
variable "project_id" {}
22

33
provider "google" {
4-
project = var.project_info.project_id
4+
project = var.project_id
55
}
66

77
resource "google_firestore_index" "default-db-index" {
@@ -19,7 +19,6 @@ resource "google_firestore_index" "default-db-index" {
1919
order = lookup(fields.value, "order", null)
2020
}
2121
}
22-
2322
}
2423

2524
resource "google_firestore_index" "named-db-index" {

scripts/decrypt_project_info.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env python
2+
3+
# Copyright 2023 Google
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
import sys
18+
import plistlib
19+
import json
20+
21+
# Check if the PLIST file path was provided as a command-line argument
22+
if len(sys.argv) != 2:
23+
print("Usage: python read_plist.py <path_to_googleService-info.plist>")
24+
sys.exit(1)
25+
26+
plist_file_path = sys.argv[1]
27+
28+
# Read the PLIST file
29+
try:
30+
with open(plist_file_path, 'rb') as plist_file:
31+
plist_data = plistlib.load(plist_file)
32+
33+
# Extract the 'project_id' field only for confidentiality
34+
project_id = plist_data.get('PROJECT_ID')
35+
36+
if project_id:
37+
with open('Firestore/Example/App/project_info.json', 'w') as json_file:
38+
json.dump({'project_id': project_id}, json_file)
39+
else:
40+
print("PROJECT_ID key not found in the plist file.")
41+
except FileNotFoundError:
42+
print(f"File not found: {plist_file_path}")
43+
except plistlib.InvalidFileException as e:
44+
print(f"Invalid plist file: {e}")
45+
except Exception as e:
46+
print(f"An error occurred: {e}")

0 commit comments

Comments
 (0)