[Resolved] Error: Provider registry.terraform.io/hashicorp/google doesn't support provider_meta

Got a weird issue here that I’ve been unable to find any information on Google about. I am simply trying to use the Kubernetes GKE Terraform module available from the module registry, but within a submodule.

Root module:


module "mysubmodule" {
  source     = "../modules/mysubmodule"
  project_id = var.project_id
}

Submodule (this is just a copy paste from the Kubernetes example):

provider "google" {
  region  = var.region
  project = var.project_id
}

data "google_client_config" "default" {}

module "gke" {
  source                     = "terraform-google-modules/kubernetes-engine/google"
  project_id                 = var.project_id
  name                       = "gke-test-1"
  region                     = "us-central1"
  zones                      = ["us-central1-a", "us-central1-b", "us-central1-f"]
  network                    = "vpc-01"
  subnetwork                 = "us-central1-01"
  ip_range_pods              = "us-central1-01-gke-01-pods"
  ip_range_services          = "us-central1-01-gke-01-services"
  http_load_balancing        = false
  horizontal_pod_autoscaling = true
  network_policy             = true

  node_pools = [
    {
      name               = "default-node-pool"
      machine_type       = "e2-medium"
      node_locations     = "us-central1-b,us-central1-c"
      min_count          = 1
      max_count          = 100
      local_ssd_count    = 0
      disk_size_gb       = 100
      disk_type          = "pd-standard"
      image_type         = "COS"
      auto_repair        = true
      auto_upgrade       = true
      service_account    = "project-service-account@<PROJECT ID>.iam.gserviceaccount.com"
      preemptible        = false
      initial_node_count = 80
    },
  ]

  node_pools_oauth_scopes = {
    all = []

    default-node-pool = [
      "https://www.googleapis.com/auth/cloud-platform",
    ]
  }

  node_pools_labels = {
    all = {}

    default-node-pool = {
      default-node-pool = true
    }
  }

  node_pools_metadata = {
    all = {}

    default-node-pool = {
      node-pool-metadata-custom-value = "my-node-pool"
    }
  }

  node_pools_taints = {
    all = []

    default-node-pool = [
      {
        key    = "default-node-pool"
        value  = true
        effect = "PREFER_NO_SCHEDULE"
      },
    ]
  }

  node_pools_tags = {
    all = []

    default-node-pool = [
      "default-node-pool",
    ]
  }
}

Running terraform init works, but terraform plan or apply yields:


Error: Provider registry.terraform.io/hashicorp/google doesn't support provider_meta

  on .terraform/modules/prod_infra.gke/versions.tf line 31, in terraform:
  31:   provider_meta "google" {

The resource data.google_client_config.default belongs to a provider that
doesn't support provider_meta blocks


Error: Provider registry.terraform.io/hashicorp/google doesn't support provider_meta

  on .terraform/modules/prod_infra.gke/versions.tf line 31, in terraform:
  31:   provider_meta "google" {

The resource data.google_container_engine_versions.region belongs to a
provider that doesn't support provider_meta blocks


Error: Provider registry.terraform.io/hashicorp/google doesn't support provider_meta

  on .terraform/modules/prod_infra.gke/versions.tf line 31, in terraform:
  31:   provider_meta "google" {

The resource google_service_account.cluster_service_account[0] belongs to a
provider that doesn't support provider_meta blocks


Error: Provider registry.terraform.io/hashicorp/google doesn't support provider_meta

  on .terraform/modules/prod_infra.gke/versions.tf line 31, in terraform:
  31:   provider_meta "google" {

The resource data.google_compute_zones.available belongs to a provider that
doesn't support provider_meta blocks

Not really sure what to make of this, as obviously the google provider supports provider_meta blocks. Is there something I need to do to pass provider information from the root module to the submodule that will allow this to work? Thanks for your help!

This was resolved by updating the google provider from 3.39 to 3.58 via terraform init --upgrade.