From 8775b47c81d48003e977f440ea0058b109886c4d Mon Sep 17 00:00:00 2001 From: Menna Tullah Magdy Taha Date: Fri, 8 Mar 2024 12:53:07 +0100 Subject: [PATCH] Remove working directory as it can't be found --- .github/workflows/terraform.yml | 13 +++---------- main.tf | 12 ++++++------ variables.auto.tfvars | 4 +--- variables.tf | 10 ---------- 4 files changed, 10 insertions(+), 29 deletions(-) diff --git a/.github/workflows/terraform.yml b/.github/workflows/terraform.yml index be401bf..cdb4bac 100644 --- a/.github/workflows/terraform.yml +++ b/.github/workflows/terraform.yml @@ -42,22 +42,18 @@ jobs: # Initialize a new or existing Terraform working directory by creating initial files, loading any remote state, downloading modules, etc. - name: Terraform Init run: terraform init - working-directory: Terraform # formats the file - name: Terraform Format run: terraform fmt - working-directory: Terraform # Generates an execution plan for Terraform - name: Terraform Plan - run: terraform plan -var 'gcp_credentials=${{ secrets.GCP_SA_KEY }}' -var 'gke_cluster_name=${{ github.event.inputs.clusterName }}" -var 'gcp_region=${{ github.event.inputs.gkeRegion }}' - working-directory: Terraform + run: terraform plan -var 'gcp_credentials=${{ secrets.GCP_SA_KEY }}' -var 'gke_cluster_name=${{ github.event.inputs.clusterName }}' -var 'gcp_region=${{ github.event.inputs.gkeRegion }}' # Apply terraform - name: Terraform Apply - run: terraform apply -auto-approve - working-directory: Terraform + run: terraform apply -var 'gcp_credentials=${{ secrets.GCP_SA_KEY }}' -var 'gke_cluster_name=${{ github.event.inputs.clusterName }}' -var 'gcp_region=${{ github.event.inputs.gkeRegion }}' -auto-approve destroy_cluster: runs-on: ubuntu-latest @@ -90,14 +86,11 @@ jobs: # Initialize a new or existing Terraform working directory by creating initial files, loading any remote state, downloading modules, etc. - name: Terraform Init run: terraform init - working-directory: Terraform # formats the file - name: Terraform Format run: terraform fmt - working-directory: Terraform # Destroy cluster - name: Terraform Destroy - run: terraform destroy -var 'gcp_credentials=${{ secrets.GCP_SA_KEY }}' -var 'gke_cluster_name=${{ github.event.inputs.clusterName }}" -var 'gcp_region=${{ github.event.inputs.gkeRegion }}' -auto-approve - working-directory: Terraform + run: terraform destroy -var 'gcp_credentials=${{ secrets.GCP_SA_KEY }}' -var 'gke_cluster_name=${{ github.event.inputs.clusterName }}' -var 'gcp_region=${{ github.event.inputs.gkeRegion }}' -auto-approve diff --git a/main.tf b/main.tf index 7f11e04..55030bf 100644 --- a/main.tf +++ b/main.tf @@ -5,23 +5,23 @@ module "gke" { region = var.gcp_region regional = var.gke_regional zones = var.gke_zones - network = var.gke_network - subnetwork = var.gke_subnetwork + network = google_compute_network.network-trial.id + subnetwork = google_compute_network.network-trial.subnetwork-trial.id + ip_range_pods = google_compute_network.subnetwork-trial.range-1.id + ip_range_services = "services_default_name" http_load_balancing = false network_policy = false horizontal_pod_autoscaling = true filestore_csi_driver = false - ip_range_services = "europe-west1-01-gke-01-services" - ip_range_pods = "europe-west1-01-gke-01-pods" node_pools = [ { name = var.gke_default_nodepools_name - machine_type = "e2-medium" + machine_type = "e2-micro" min_count = 1 max_count = 3 local_ssd_count = 0 spot = false - disk_size_gb = 100 + disk_size_gb = 30 disk_type = "pd-standard" image_type = "COS_CONTAINERD" enable_gcfs = false diff --git a/variables.auto.tfvars b/variables.auto.tfvars index e0846cc..784c0b4 100644 --- a/variables.auto.tfvars +++ b/variables.auto.tfvars @@ -1,7 +1,5 @@ gcp_project_id = "deploying-with-terraform" gke_zones = ["europe-west3-b"] gke_regional = false -gke_network = "default" -gke_subnetwork = "default" gke_default_nodepools_name = "nodes_pool" -gke_service_account_name = "serviceAccount:terraform-gke@deploying-with-terraform.iam.gserviceaccount.com" +gke_service_account_name = "terraform-gke@deploying-with-terraform.iam.gserviceaccount.com" diff --git a/variables.tf b/variables.tf index b8c0ca8..29a1347 100644 --- a/variables.tf +++ b/variables.tf @@ -23,16 +23,6 @@ variable "gke_regional" { description = "regional choice" } -variable "gke_network" { - type = string - description = "VPC network name" -} - -variable "gke_subnetwork" { - type = string - description = "VPC subnetwork name" -} - variable "gke_default_nodepools_name" { type = string description = "default name for node pool"