diff --git a/provisioning/templates-api/gcp.sh b/provisioning/templates-api/gcp.sh deleted file mode 100644 index 737d5366e2..0000000000 --- a/provisioning/templates-api/gcp.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env bash -set -Eeuo pipefail - -terraform_output () { - terraform -chdir=./gcp output -raw $1 -} - -SCRIPT_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -cd "${SCRIPT_PATH}" - - -if [ -n "${TF_INIT_ONLY:-}" ]; then - terraform init -no-color -backend=false - exit 0 -fi - -echo "" -echo "Terraform backend configuration:" -echo "bucket=${TERRAFORM_REMOTE_STATE_BUCKET}" -echo "" - -terraform -chdir=./gcp init -input=false -no-color \ - -backend-config="bucket=${TERRAFORM_REMOTE_STATE_BUCKET}" \ - -backend-config="prefix=keboola-as-code/templates-api" - -echo "=> Validating configuration" -terraform validate -no-color - -echo "=> Planning changes" -terraform -chdir=./gcp plan -input=false -no-color -out=terraform.tfplan \ - -var "terraform_remote_state_bucket=${TERRAFORM_REMOTE_STATE_BUCKET}" - -echo "=> Applying changes" -terraform -chdir=./gcp apply -no-color terraform.tfplan - -# Authorize to GKE -GKE_CLUSTER_NAME=$(terraform_output main_gke_cluster_name) -GKE_CLUSTER_LOCATION=$(terraform_output main_gke_cluster_location) - -echo $GKE_CLUSTER_NAME -echo $GKE_CLUSTER_LOCATION - -gcloud auth login --cred-file=$GOOGLE_APPLICATION_CREDENTIALS - -# https://cloud.google.com/blog/products/containers-kubernetes/kubectl-auth-changes-in-gke -echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list -curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - -sudo apt update -sudo apt-get install google-cloud-sdk-gke-gcloud-auth-plugin - -gcloud container clusters get-credentials $GKE_CLUSTER_NAME --region $GKE_CLUSTER_LOCATION --project $GCP_PROJECT - -# Common part of the deploy -export ETCD_STORAGE_CLASS_NAME= -. ./common.sh - -# GCP specific part of the deploy -kubectl apply -f ./kubernetes/deploy/cloud/gcp/service.yaml -kubectl apply -f ./kubernetes/deploy/cloud/gcp/ingress.yaml - -# Wait for the rollout -. ./wait.sh diff --git a/provisioning/templates-api/gcp/.gitignore b/provisioning/templates-api/gcp/.gitignore deleted file mode 100644 index 810ec2b952..0000000000 --- a/provisioning/templates-api/gcp/.gitignore +++ /dev/null @@ -1,38 +0,0 @@ -# Local .terraform directories -**/.terraform/* - -# .tfstate files -*.tfstate -*.tfstate.* - -# Crash log files -crash.log - -# Exclude all .tfvars files, which are likely to contain sentitive data, such as -# password, private keys, and other secrets. These should not be part of version -# control as they are data points which are potentially sensitive and subject -# to change depending on the environment. -# -*.tfvars - -# Ignore override files as they are usually used to override resources locally and so -# are not checked in -override.tf -override.tf.json -*_override.tf -*_override.tf.json - -# Include override files you do wish to add to version control using negated pattern -# -# !example_override.tf - -# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan -# example: *tfplan* - -# Ignore CLI configuration files -.terraformrc -terraform.rc - -terraform.tfplan - -.env \ No newline at end of file diff --git a/provisioning/templates-api/gcp/main.tf b/provisioning/templates-api/gcp/main.tf deleted file mode 100644 index c625395e72..0000000000 --- a/provisioning/templates-api/gcp/main.tf +++ /dev/null @@ -1,22 +0,0 @@ -terraform { - required_version = "~> 1.1" - backend "gcs" {} -} - -# Read shared infrastructure outputs -data "terraform_remote_state" "infrastructure" { - backend = "gcs" - - config = { - bucket = var.terraform_remote_state_bucket - prefix = "infrastructure/output" - } -} - -output "main_gke_cluster_name" { - value = data.terraform_remote_state.infrastructure.outputs.main_gke_cluster_name -} - -output "main_gke_cluster_location" { - value = data.terraform_remote_state.infrastructure.outputs.main_gke_cluster_location -} \ No newline at end of file diff --git a/provisioning/templates-api/gcp/variables.tf b/provisioning/templates-api/gcp/variables.tf deleted file mode 100644 index 0b824daac3..0000000000 --- a/provisioning/templates-api/gcp/variables.tf +++ /dev/null @@ -1,3 +0,0 @@ -variable "terraform_remote_state_bucket" { - type = string -}