Terraform 错误:错误锁定状态:获取状态锁定错误:发生 2 个错误: [英] Terraform Error: Error locking state: Error acquiring the state lock: 2 errors occurred:
问题描述
我尝试了 terraform 版本 v0.12.26 和 v0.13.3.都失败了.
I tried terraform versions v0.12.26 and v0.13.3. Both failed.
地形规划
获取状态锁.这可能需要一些时间...
Acquiring state lock. This may take a few moments...
错误:错误锁定状态:获取状态锁定错误:发生 2 个错误:* ResourceNotFoundException: 未找到请求的资源* ResourceNotFoundException: 未找到请求的资源
Error: Error locking state: Error acquiring the state lock: 2 errors occurred: * ResourceNotFoundException: Requested resource not found * ResourceNotFoundException: Requested resource not found
Terraform 获取状态锁以保护状态不被写入多个用户同时使用.请解决上述问题并尝试再次.对于大多数命令,您可以使用-lock=false"禁用锁定.标记,但不建议这样做.
Terraform acquires a state lock to protect the state from being written by multiple users at the same time. Please resolve the issue above and try again. For most commands, you can disable locking with the "-lock=false" flag, but this is not recommended.
相关源码:
terraform {
backend "s3" {
encrypt = false
bucket = "dev-terraform-state"
key = "dev/Oregon/eks/terraform.tfstate"
region = "us-west-2"
dynamodb_table = "dev-lock-table"
}
required_version = ">= 0.12.0"
}
推荐答案
错误是ResourceNotFoundException
,提示你的dev-lock-table
不存在.
The error is ResourceNotFoundException
, which suggests that your dev-lock-table
does not exist.
Terraform 不会创建它.相反,它必须在您使用它之前存在.来自 docs:
Terraform does not create it. Instead it must exist before you will use it. From docs:
dynamodb_table 字段到现有 DynamoDB 表名.
dynamodb_table field to an existing DynamoDB table name.
这篇关于Terraform 错误:错误锁定状态:获取状态锁定错误:发生 2 个错误:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!