Search code examples
terraformterraform-provider-gcp

Terraform: unknown resource type: google_cloud_run_v2_service


Terraform v1.4.6
on darwin_amd64
+ provider registry.terraform.io/hashicorp/google v3.74.0
+ provider registry.terraform.io/hashicorp/random v3.1.0

According to this documentation, the terraform resource exists. However, when trying to use

terraform import google_cloud_run_v2_service.cloud-run project-id/us-east4/service-name

The error I get is unknown resource type: google_cloud_run_v2_service. What's going on here? Is the documentation lying or am I doing something wrong?

My .tf file as it currently is for the moment while I import.

resource "google_cloud_run_v2_service" "cloud-run" {
    
}

Solution

  • The google_cloud_run_v2_service was added in version 4.46.0 of the Terraform Google provider. Your provider version according to the question is 3.74.0. You will need to update the provider version accordingly:

    terraform {
      required_providers {
        google = {
          source  = "hashicorp/google"
          version = "~> 4.46.0"
        }
      }
    }