我正在尝试使用Terraform v0.14.3部署Bitbucket管道以在Google Cloud中创建资源。运行terraform命令后,管道出现以下错误:
Error: Invalid legacy provider address
This configuration or its associated state refers to the unqualified provider
"google".
You must complete the Terraform 0.13 upgrade process before upgrading to later
versions.
我们将本地版本的terraform更新到0.13.0并运行了以下命令:terraform 0.13upgrade
,参考了此指南:https://www.terraform.io/upgrade-guides/0-13.html。 然后生成了versions.tf文件,要求terraform版本>=0.13,并且我们所需提供程序块现在看起来像这样:
terraform {
backend "gcs" {
bucket = "some-bucket"
prefix = "terraform/state"
credentials = "key.json" #this is just a bitbucket pipeline variable
}
required_providers {
google = {
source = "hashicorp/google"
version = "~> 2.20.0"
}
}
}
provider "google" {
project = var.project_ID
credentials = "key.json"
region = var.project_region
}
当我们启动bitbucket pipeline时,仍然会遇到相同的错误。有人知道如何解决这个问题吗?提前感谢。