英文:
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"
}
}
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论