Unsupported Terraform Version

Hello folks,

I am facing an issue while I run terraform plan on the below code:
I have the following code in gke-nodes.tf

resource "google_container_node_pool" "gke_cluster_pool_green_v122" {
  count    = var.node_green_max_count > 0 ? 1 : 0
  name     = substr(join("", [var.name, "-pool-green-v122"]), 0, 40)
  cluster  = google_container_cluster.gke_cluster.name
  location = var.location

  max_pods_per_node  = var.node_green_max_pods_per_node
  initial_node_count = 1 - var.legacy_nodepool_bootstrap

  management {
    auto_repair  = true
    auto_upgrade = false
  }

  upgrade_settings {
    max_unavailable = 0
    max_surge       = 1
  }

  autoscaling {
    min_node_count = var.node_green_min_count
    max_node_count = var.node_green_max_count
  }

  lifecycle {
    ignore_changes = [
      initial_node_count
    ]
  }

  node_config {
    preemptible  = false
    machine_type = var.node_green_machine_type
    disk_type    = "pd-ssd"
    tags = [
      var.gke_node_tag,
      var.gke_node_general_tag,
    ]
    labels = {
      "node.pubnative.io/role"  = "general",
      "node.pubnative.io/tier"  = "1",
      "node.pubnative.io/color" = "green",
    }
  }
  version = var.nodepool_version
}

I am running terraform init, terraform plan and terraform apply from a folder gcp/vgi-pn/us-east4/staging-cluster/tf/ which has a file call cluster.tf

The error I get is

[1me[31mError: e[0me[0me[1mUnsupported Terraform Core versione[0m

e[0mThis configuration does not support Terraform version `0.12.29`. To proceed,
either choose another supported Terraform version or update the root module's
version constraint. Version constraints are normally set for good reason, so
updating the constraint may lead to other errors or unexpected behavior.
e[0me[0m

My backend.tf has the following code

terraform {
  # Please don't change this, use https://github.com/asdf-vm/asdf
  required_version = "0.12.31"

  required_providers {
    google = {
      version = "~> 4"
    }
    google-beta = {
      version = "~> 4"
    }
    kubernetes = {
      version = "~> 2.7.1"
    }
    helm = {
      version = "~> 2.4.1"
    }
  }

Could someone help me in pointing out what the issue here is? Any help here would be much appreciated

Thanks,
Sahaj

Hi @sahajhaksh,

In the code you shared I notice this comment:

  # Please don't change this, use https://github.com/asdf-vm/asdf
  required_version = "0.12.31"

I assume that this comment was written by one of your coworkers, and it suggests that they are intending you to run Terraform using the third-party helper program asdf, which is one of many similar programs that can install potentially many different versions of tools such as Terraform and then automatically select the correct version to use in each context.

Based on that I think I would try to find who added that comment and see if they can give you some guidance on how they expected you to set up your development environment, because there may be some other assumptions that I can’t guess.

However, to focus just on this problem: it appears that the person who wrote this comment intended you to install asdf and then set up the asdf-hashicorp community plugin to install Terraform. Assuming that the rest of this development has been set up correctly (including the configuration files for asdf), running Terraform should then run the specific version of Terraform that that your team is intending for you to use.

(You may need to uninstall the Terraform you installed manually first, so that it won’t conflict with the Terraform versions installed using asdf.)

Hi @apparentlymart,

Thanks for your response. I will try to debug and work on these suggestions