<h2>Background</h2>
<p>I have been playing around with GCP free plan. I am trying to learn how to apply gitops with IaC. To do so I'm trying to create the infrastructure for a kubernetes cluster using terraform, using google as the cloud provider.</p>
<p>Managed to configure the Github Actions to apply the changes when a push is made. However I get the following error:</p>
<pre><code>│ Error: googleapi: Error 403: Insufficient regional quota to satisfy request: resource &quot;SSD_TOTAL_GB&quot;: request requires '300.0' and is short '50.0'. project has a quota of '250.0' with '250.0' available. View and manage quotas at https://console.cloud.google.com/iam-admin/quotas?usage=USED&amp;project=swift-casing-370717., forbidden
│ 
│   with google_container_cluster.primary,
│   on main.tf line 26, in resource &quot;google_container_cluster&quot; &quot;primary&quot;:
│   26: resource &quot;google_container_cluster&quot; &quot;primary&quot; ***
</code></pre>
<h2>Configuration</h2>
<p>The above mentioned terraform configuration file is the following:</p>
<pre><code># https://registry.terraform.io/providers/hashicorp/google/latest/docs
provider &quot;google&quot; {
  project = &quot;redacted&quot;
  region  = &quot;europe-west9&quot;
}

# https://www.terraform.io/language/settings/backends/gcs
terraform {
  backend &quot;gcs&quot; {
    bucket = &quot;redacted&quot;
    prefix = &quot;terraform/state&quot;
  }
  required_providers {
    google = {
      source  = &quot;hashicorp/google&quot;
      version = &quot;~&gt; 4.0&quot;
    }
  }
}

resource &quot;google_service_account&quot; &quot;default&quot; {
  account_id   = &quot;service-account-id&quot;
  display_name = &quot;We still use master&quot;
}

resource &quot;google_container_cluster&quot; &quot;primary&quot; {
  name     = &quot;k8s-cluster&quot;
  location = &quot;europe-west9&quot;

  # We can't create a cluster with no node pool defined, but we want to only use
  # separately managed node pools. So we create the smallest possible default
  # node pool and immediately delete it.
  remove_default_node_pool = true
  initial_node_count       = 1
}

resource &quot;google_container_node_pool&quot; &quot;primary_preemptible_nodes&quot; {
  name       = &quot;k8s-node-pool&quot;
  location   = &quot;europe-west9&quot;
  cluster    = google_container_cluster.primary.name
  node_count = 1

  node_config {
    preemptible  = true
    machine_type = &quot;e2-small&quot;

    # Google recommends custom service accounts that have cloud-platform scope and permissions granted via IAM Roles.
    service_account = google_service_account.default.email
    oauth_scopes = [
      &quot;https://www.googleapis.com/auth/cloud-platform&quot;
    ]
  }
}
</code></pre>
<h2>Problem</h2>
<p>It seems that I need to limit the resources so they use up to 250 GB, how can I do so?</p>
<h2>What I have tried</h2>
<h4>Reducing <a href="https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_cluster#disk_size_gb" rel="nofollow noreferrer">node_pool size</a>.</h4>
<p>According to the documentation default size is 100GB and changed it to 50 as follows:</p>
<pre><code>resource &quot;google_container_node_pool&quot; &quot;primary_preemptible_nodes&quot; {
  name       = &quot;k8s-node-pool&quot;
  location   = &quot;europe-west9&quot;
  cluster    = google_container_cluster.primary.name
  node_count = 1

  node_config {
    preemptible  = true
    machine_type = &quot;e2-small&quot;
    disk_size_gb = 50

    # Google recommends custom service accounts that have cloud-platform scope and permissions granted via IAM Roles.
    service_account = google_service_account.default.email
    oauth_scopes = [
      &quot;https://www.googleapis.com/auth/cloud-platform&quot;
    ]
  }
}
</code></pre>
<p>Despite reducing the size the error message did not change at all.</p>

<p>The <code>google_container_cluster</code> resource also allows you to specify disk usage. Update the configuration as follows:</p>
<pre><code>resource &quot;google_container_cluster&quot; &quot;primary&quot; {
  name     = &quot;k8s-cluster&quot;
  location = &quot;europe-west9&quot;

  # We can't create a cluster with no node pool defined, but we want to only use
  # separately managed node pools. So we create the smallest possible default
  # node pool and immediately delete it.
  remove_default_node_pool = true
  initial_node_count       = 1

  node_config {
    disk_size_gb = 50
  }

}

</code></pre>
