我使用terraform创建了一个dynamodb表,并向其中添加了一个项。但是,我得到这个错误"json:无法将字符串解组为dynamodb.AttributeValue类型的Go值“。
resource "aws_dynamodb_table_item" "itemone" {
depends_on = [
aws_dynamodb_table.demo_dynamo_table
]
# required
table_name = aws_dynamodb_table.demo_dynamo_table.name
# required
hash_key = aws_dynamodb_table.demo_dynamo_table.hash_key
# key value item s attributes
item = <<ITEM
{
"clientId": {"S": "001"},
"clientAge": {"N": "11"},
"other": {"N": "55"}
}
ITEM
}我的桌子
# Create_dynamoDb table
resource "aws_dynamodb_table" "demo_dynamo_table" {
name = "Client" #required uniq within region
billing_mode = "PROVISIONED"
hash_key = "clientId"
range_key = "clientAge"
#required
attribute {
name = "clientId"
type = "S"
}
attribute {
name = "clientAge"
type = "N"
} 发布于 2022-05-11 15:55:38
似乎缺少了一条线,那是range_key的一条。我添加了以下内容,它起作用了:
range_key = aws_dynamodb_table.demo_dynamo_table.range_key 击败,
https://stackoverflow.com/questions/72204079
复制相似问题