amazon-dynamodb - 带有 DynamoDB 后端的 terraform:创建新工作区时出现 400 Bad Request
问题描述
我有 terraform 堆栈,可以在 DynamoDB 中保持锁定:
terraform {
backend "s3" {
bucket = "bucketname"
key = "my_key"
encrypt = "true"
role_arn = "arn:aws:iam::11111111:role/my_role"
dynamodb_table = "tf-remote-state-lock"
}
}
当我运行terraform workspace new test
它失败并出现(相当误导)错误:
failed to lock s3 state: 2 errors occurred:
* ResourceNotFoundException: Requested resource not found
* ResourceNotFoundException: Requested resource not found
如果我打开,TF_LOG=DEBUG
我会看到400 Bad Request
(有关 pastebin 的更多详细信息)
我做错了什么以及如何解决?
解决方案
解决方案:terraform workspace whatsoever
应该只在 AFTER 之后朗姆酒terraform init
。如果你已经TF_WORKSPACE
设置好了,你可能会在tf init
说工作空间不存在的时候报错,所以你tf ws new
之前可能会有朗姆酒的诱惑tf init
。不要这样做,只是在之后设置。TF_WORKSPACE
tf init
推荐阅读
- pandas - 循环编程 Pandas 交叉表
- asp.net-mvc - 数据注释属性验证与 MVC 中的客户端验证有何不同?
- reactjs - 子组件相互更新?
- c# - 为什么此 c# 代码无法编译 - 来自 StreamingMedia 的资产包/对象
- android - Android 应用中的 Material Design 主题 - 菜单项图标未从主题继承
- javascript - 我无法在反应中访问数据
- python - 为什么 np.corrcoef() 标准化为统一?
- javascript - 如何将栅格图层导入到传单 web 地图中?
- spring-boot - spring boot dynamodb 吞吐量配置
- javascript - 如何对被推入最初为空的数组的索引项求和?