Skip to content

Commit

Permalink
josn key auth support for inventory
Browse files Browse the repository at this point in the history
  • Loading branch information
abidknashtech committed Nov 13, 2023
1 parent 1ee7b64 commit 4eb9c84
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
20 changes: 19 additions & 1 deletion deployment/gcpresources/terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,24 @@ resource "google_pubsub_topic" "Vehicle" {
message_retention_duration = "604800s"
}

resource "google_pubsub_subscription" "inventory_subscription" {
name = "inventory_subscription"
topic = google_pubsub_topic.Vehicle.name

# 20 minutes
message_retention_duration = "1200s"
retain_acked_messages = true

ack_deadline_seconds = 20
expiration_policy {
ttl = "300000.5s"
}
retry_policy {
minimum_backoff = "10s"
}
enable_message_ordering = false
}

#-----------------------GKE Cluster for applications----------------------------
resource "google_container_cluster" "car-demo-gke" {
name = "car-demo-gke"
Expand Down Expand Up @@ -144,5 +162,5 @@ resource "google_secret_manager_secret" "car-demo-secret" {
resource "google_secret_manager_secret_version" "car-demo-secret-1" {

secret = google_secret_manager_secret.car-demo-secret.id
secret_data = "{\"mysql-db-username\": \"${var.user_name}\", \"mysql-db-userpassword\": \"${var.user_password}\"}"
secret_data = "{\"mysql-db-username\": \"${var.user_name}\", \"mysql-db-userpassword\": \"${var.user_password}\", \"gcp_json_key\": \"${var.gcp_json_key}\"}"
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,12 @@ variable user_name {
default = "dbadmin"
}

variable user_password {
variable guser_password {
description = "The password for the default user. If not set, a random one will be generated and available in the generated_user_password output variable."
default = "JavaDBs#password2023"
}

variable gcp_json_key {
description = "GCP Json key"
default = "{}"
}
11 changes: 11 additions & 0 deletions inventory-service/gcp-deploy-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ spec:
name: secret-to-be-created
key: mysql-db-userpassword
optional: false
- name: GOOGLE_APPLICATION_CREDENTIALS
valueFrom:
secretKeyRef:
name: secret-to-be-created
key: gcp_json_key
optional: false
envFrom:
- configMapRef:
name: inventory-configmap
Expand Down Expand Up @@ -93,6 +99,11 @@ spec:
key: car-demo-secret
version: latest
property: mysql-db-userpassword
- secretKey: "gcp_json_key"
remoteRef:
key: car-demo-secret
version: latest
property: gcp_json_key

- secretKey: "MY_SQL_SECRETS"
remoteRef:
Expand Down

0 comments on commit 4eb9c84

Please sign in to comment.