【发布时间】:2021-05-28 22:33:39
【问题描述】:
我有一个用这个 Terraform 创建的 DynamoDB 表:
resource "aws_dynamodb_table" "materials_table" {
name = "materials"
hash_key = "MATERIAL"
billing_mode = "PROVISIONED"
read_capacity = 5
write_capacity = 5
attribute {
name = "MATERIAL"
type = "S"
}
}
表已成功填充(有 4 条记录,如 this post 中所述)但为了解决问题(在那篇文章中)我添加了一个字段 PK 并将其设置为 hash_key 字段,用这个:
resource "aws_dynamodb_table" "materials_table" {
name = "materials"
hash_key = "PK"
billing_mode = "PROVISIONED"
read_capacity = 5
write_capacity = 5
attribute {
name = "PK"
type = "S"
}
}
这导致运行terraform apply时出现以下错误:
Error: error creating DynamoDB Table: ResourceInUseException: Table already exists: materials
我需要在.tf 中做什么才能让更改被接受?
【问题讨论】:
标签: amazon-web-services amazon-dynamodb terraform-provider-aws terraform0.14.7