Terraform: 未知的资源类型: google_cloud_run_v2_service

huangapple go评论59阅读模式
英文:

Terraform: unknown resource type: google_cloud_run_v2_service

问题

Terraform v1.4.6
在 darwin_amd64 上
+ 提供者 registry.terraform.io/hashicorp/google v3.74.0
+ 提供者 registry.terraform.io/hashicorp/random v3.1.0

根据此文档,Terraform 资源已存在。但是,尝试使用以下命令时:

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

我收到的错误消息是 unknown resource type: google_cloud_run_v2_service。这里发生了什么?文档是否有误,还是我做错了什么?

我的 .tf 文件当前的内容如下:

resource "google_cloud_run_v2_service" "cloud-run" {

}
英文:
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" {
    
}

答案1

得分: 2

google_cloud_run_v2_service 是在 Terraform Google 提供程序的 版本 4.46.0 中添加的。根据问题,你的提供程序版本是 3.74.0。你需要相应地更新提供程序版本:

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

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"
    }
  }
}

huangapple
  • 本文由 发表于 2023年5月11日 04:19:19
  • 转载请务必保留本文链接:https://go.coder-hub.com/76222273.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定