Skip to content

Commit

Permalink
feat: remove dependencies on bash and jq for GCP deployment (#1291)
Browse files Browse the repository at this point in the history
  • Loading branch information
lemaitre-aneo authored May 7, 2024
2 parents c15d7aa + 226d487 commit f31f650
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
18 changes: 4 additions & 14 deletions infrastructure/quick-deploy/gcp/common.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,11 @@ resource "random_string" "prefix" {
numeric = true
}

resource "local_file" "date_sh" {
filename = "${path.module}/generated/date.sh"
content = local.date
}

data "external" "static_timestamp" {
program = ["bash", "date.sh"]
working_dir = "${path.module}/generated"
depends_on = [local_file.date_sh]
program = ["sh", "-c", <<-EOT
echo "{\"date\": \"$(date +%F-%H-%M-%S)\"}"
EOT
]
}

resource "null_resource" "timestamp" {
Expand All @@ -54,10 +50,4 @@ locals {
}, var.labels)
node_pools_labels = { for key, value in var.gke.node_pools_labels : key => merge(local.labels, value) }
node_pools_tags = { for node_pool in coalesce(var.gke.node_pools, []) : node_pool["name"] => values(local.labels) }
date = <<-EOT
#!/bin/bash
set -e
DATE=$(date +%F-%H-%M-%S)
jq -n --arg date "$DATE" '{"date":$date}'
EOT
}
2 changes: 1 addition & 1 deletion infrastructure/quick-deploy/gcp/gke.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module "gke" {
subnetwork_cidr = module.vpc.gke_subnet_cidr_block
ip_range_pods = module.vpc.gke_subnet_pods_range_name
ip_range_services = module.vpc.gke_subnet_svc_range_name
kubeconfig_path = abspath(var.gke.kubeconfig_file)
kubeconfig_path = var.gke.generate_kubeconfig ? abspath(var.gke.kubeconfig_file) : null
service_account_name = local.gke_name
database_encryption = [
{
Expand Down
1 change: 1 addition & 0 deletions infrastructure/quick-deploy/gcp/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ variable "gke" {
services_cidr_block = optional(string, "172.17.17.0/24")
}), {})
namespace = optional(string, "armonik")
generate_kubeconfig = optional(bool, true)
kubeconfig_file = optional(string, "generated/kubeconfig")
enable_public_gke_access = optional(bool, true)
enable_gke_autopilot = optional(bool, false)
Expand Down

0 comments on commit f31f650

Please sign in to comment.