Skip to content

Commit

Permalink
redeploy gke
Browse files Browse the repository at this point in the history
  • Loading branch information
tunacinsoy committed Aug 19, 2024
1 parent 4a919f3 commit 3e7fb43
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 41 deletions.
16 changes: 0 additions & 16 deletions manifests/blog-app/mongodb-creds-sealed.yaml

This file was deleted.

30 changes: 15 additions & 15 deletions terraform/app.tf
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# This hcl file is responsible for the configuration deployment that will be used by ArgoCD

# # ApplicationSet resource for the applications that argoCD will manage
# data "kubectl_file_documents" "apps" {
# content = file("../manifests/argocd/apps.yaml")
# }
# ApplicationSet resource for the applications that argoCD will manage
data "kubectl_file_documents" "apps" {
content = file("../manifests/argocd/apps.yaml")
}

# resource "kubectl_manifest" "apps" {
# # Needs to depend on argocd deployment, since we'll configure it after deployment finishes
# depends_on = [kubectl_manifest.argocd]
# # for_each iterates over each manifest in the namespace file
# for_each = data.kubectl_file_documents.apps.manifests
# # Applies the content of each manifest to the Kubernetes cluster
# yaml_body = each.value
# # Forces the namespace to be set to argocd, ensuring that all resources are created in the correct namespace
# override_namespace = "argocd"
# }
resource "kubectl_manifest" "apps" {
# Needs to depend on argocd deployment, since we'll configure it after deployment finishes
depends_on = [kubectl_manifest.argocd]
# for_each iterates over each manifest in the namespace file
for_each = data.kubectl_file_documents.apps.manifests
# Applies the content of each manifest to the Kubernetes cluster
yaml_body = each.value
# Forces the namespace to be set to argocd, ensuring that all resources are created in the correct namespace
override_namespace = "argocd"
}

# MANAGING SECRETS USING External Secrets
# # External-Secrets operator for the retrieval of secrets
# External-Secrets operator for the retrieval of secrets
# data "kubectl_file_documents" "external-secrets" {
# content = file("../manifests/argocd/external-secrets.yaml")
# }
Expand Down
20 changes: 10 additions & 10 deletions terraform/cluster.tf
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
# This file is responsible for the creation of gke cluster, and a service account.

resource "google_service_account" "main" {
# Since there will be two clusters for 'prod' and 'dev' envs, we need to be able to
# distinguish their service accounts.
account_id = "gke-${var.cluster_name}-${var.branch}-sa"
display_name = "GKE Cluster ${var.cluster_name}-${var.branch} Service Account"
}
# resource "google_service_account" "main" {
# # Since there will be two clusters for 'prod' and 'dev' envs, we need to be able to
# # distinguish their service accounts.
# account_id = "gke-${var.cluster_name}-${var.branch}-sa"
# display_name = "GKE Cluster ${var.cluster_name}-${var.branch} Service Account"
# }

# After the creation of service account, the email attribute will be exposed automatically.
# With locals definition, it will be more readable for users to see which attributes are created.
locals {
service_account_email = google_service_account.main.email
}
# locals {
# service_account_email = google_service_account.main.email
# }

resource "google_container_cluster" "main" {
name = "${var.cluster_name}-${var.branch}"
location = var.location
initial_node_count = 3

node_config {
service_account = local.service_account_email # Retrieving the email of the service account from locals
# service_account = local.service_account_email # Retrieving the email of the service account from locals
disk_size_gb = 10 # Setting disk size to 10 GB because of the free account quota limits
oauth_scopes = [
# This scope is a Google Cloud OAuth scope that grants the client full access to all Google Cloud services.
Expand Down

0 comments on commit 3e7fb43

Please sign in to comment.