mirror of
https://github.com/opentffoundation/opentf.git
synced 2025-12-19 17:59:05 -05:00
Add logging for dynamodb client in s3 backend (#3103)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
This commit is contained in:
@@ -20,6 +20,7 @@ ENHANCEMENTS:
|
||||
* Add support for the `for_each` attribute in the `mock_provider` block. ([#3087](https://github.com/opentofu/opentofu/pull/3087))
|
||||
* Upgrade github.com/openbao/openbao/api/v2 from 2.1.0 to 2.3.0 to fix [GO-2025-3783](https://pkg.go.dev/vuln/GO-2025-3783) ([3134](https://github.com/opentofu/opentofu/pull/3134))
|
||||
* The upgrade is necessary to silence the security scanner and does not affect the actual state encryption provided by OpenBao.
|
||||
* Add logs for the DynamoDB operations in the S3 backend ([#3103](https://github.com/opentofu/opentofu/pull/3103))
|
||||
|
||||
BUG FIXES:
|
||||
|
||||
|
||||
@@ -291,6 +291,7 @@ func (c *RemoteClient) dynamoDBLock(ctx context.Context, info *statemgr.LockInfo
|
||||
ConditionExpression: aws.String("attribute_not_exists(LockID)"),
|
||||
}
|
||||
|
||||
ctx, _ = attachLoggerToContext(ctx)
|
||||
_, err := c.dynClient.PutItem(ctx, putParams)
|
||||
if err != nil {
|
||||
lockInfo, infoErr := c.getLockInfoFromDynamoDB(ctx)
|
||||
@@ -362,6 +363,7 @@ func (c *RemoteClient) getMD5(ctx context.Context) ([]byte, error) {
|
||||
ConsistentRead: aws.Bool(true),
|
||||
}
|
||||
|
||||
ctx, _ = attachLoggerToContext(ctx)
|
||||
resp, err := c.dynClient.GetItem(ctx, getParams)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -399,6 +401,8 @@ func (c *RemoteClient) putMD5(ctx context.Context, sum []byte) error {
|
||||
},
|
||||
TableName: aws.String(c.ddbTable),
|
||||
}
|
||||
|
||||
ctx, _ = attachLoggerToContext(ctx)
|
||||
_, err := c.dynClient.PutItem(ctx, putParams)
|
||||
if err != nil {
|
||||
log.Printf("[WARN] failed to record state serial in dynamodb: %s", err)
|
||||
@@ -419,6 +423,8 @@ func (c *RemoteClient) deleteMD5(ctx context.Context) error {
|
||||
},
|
||||
TableName: aws.String(c.ddbTable),
|
||||
}
|
||||
|
||||
ctx, _ = attachLoggerToContext(ctx)
|
||||
if _, err := c.dynClient.DeleteItem(ctx, params); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -435,6 +441,7 @@ func (c *RemoteClient) getLockInfoFromDynamoDB(ctx context.Context) (*statemgr.L
|
||||
ConsistentRead: aws.Bool(true),
|
||||
}
|
||||
|
||||
ctx, _ = attachLoggerToContext(ctx)
|
||||
resp, err := c.dynClient.GetItem(ctx, getParams)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -575,6 +582,7 @@ func (c *RemoteClient) dynamoDBUnlock(ctx context.Context, id string) *statemgr.
|
||||
":info": &dtypes.AttributeValueMemberS{Value: string(lockInfo.Marshal())},
|
||||
},
|
||||
}
|
||||
ctx, _ = attachLoggerToContext(ctx)
|
||||
_, err = c.dynClient.DeleteItem(ctx, params)
|
||||
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user