Reputation: 1
I'm using AWS S3 and dynamodb to maintain state file in remote backend , i keep getting the following after moving state file to remote backend using terraform .. Any idea how to resolve this?
Error: Error acquiring the state lock
│
│ Error message: operation error DynamoDB: PutItem, https response error
│ StatusCode: 400, RequestID:
│ │ ConditionalCheckFailedException: The conditional request failed
resource "aws_dynamodb_table" "" {
name = var.table_name
billing_mode = "PAY_PER_REQUEST"
hash_key = "LockID"
attribute {
name = "LockID"
type = "S"
}
Upvotes: 0
Views: 696
Reputation: 19653
ConditionalCheckFailedException
is caused by the condition that you set in your PutItem
evaluated to false. It's not an error per-se, but more so an indication on the result of the condition:
Understand what condition you're setting, and that'll allow you to understand why it's failing. You can return the item as it's stored in DynamoDB by using ReturnValuesOnConditionCheckFailedException
:
Upvotes: 0