我有一个GCP VM,其中一个GCP服务帐户已经附加。
该SA具有执行某些terraform / terragrunt相关操作的适当权限,例如查询后端配置GCS等。
因此,当我登录到VM (我已经将terraform配置文件传输到VM)时,我可以这样做。
$ terragrunt plan
Initializing the backend...
Successfully configured the backend "gcs"! Terraform will automatically
use this backend unless the backend configur
我正在将模板从terraform 0.12.31升级到0.13.7,我们需要确保我们有一个自动系统来处理在旧版本下创建的部署。
我正在解决的一个问题是,我删除了移动过程中所有null提供程序的使用。当我尝试在0.12上创建的状态文件上应用或规划时,当使用terraform版本0.13时,我会收到以下错误:
$ terraform plan --var-file MY_VAR_FILE.json
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate
在执行terraform计划-out=tfplan之后,我尝试使用远程后端在GCP上创建新的资源,然后执行terraform应用tfplan,得到以下错误:
Error: Inconsistent dependency lock file
│
│ The following dependency selections recorded in the lock file are
│ inconsistent with the configuration in the saved plan:
│ Terraform 0.13 and earlier allowed provider versio
我在GCP上使用TF 0.11.11。我的backend.tfvars文件设置可以按状态文件存储在GCP桶中:
# bucket where terraform state file will be kept
bucket = "this-is-my-tf-bucket"
# folder in the bucket where the terraform state file will be kept
prefix = "bucket.folder.sbx"
credentials = "greg-cred.json"
但是,在运行init
在自动运行terraform (即jenkins中的CI/CD )时,如果由于某些错误导致管道失败,则会导致状态文件中的锁。解锁状态文件的进程是:
terraform force-unlock id
只有当我在jenkinsfile中包含这个命令时,这个命令才对我有效。此命令不运行在云shell中,并给出错误:
Local state cannot be unlocked by another process
在天蓝色,我们有一个选择,通过门户删除通过中断租赁,我们有任何选择在GCP?
详细信息:
Terraform v0.15 provider GCP v3.63.0后端: GCP存储桶
删
问题
文档说project_id是可选的。
project_id -(可选)项目ID。如果没有提供它,则使用提供程序项目。
然而,Terraform抱怨说这是必需的。
gcp.tf
data "google_project" "project" {
}
output "project_number" {
value = data.google_project.project.number
}
Error: project: required field is not set
│
│ with data.google_proj