Skip to content

Commit

Permalink
Should fix dynamodb
Browse files Browse the repository at this point in the history
Signed-off-by: ItalyPaleAle <[email protected]>
  • Loading branch information
ItalyPaleAle committed Aug 2, 2023
1 parent 577fd09 commit fa715be
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ resource "aws_dynamodb_table" "conformance_test_basic_table" {
billing_mode = "PROVISIONED"
read_capacity = "10"
write_capacity = "10"
ttl {
attribute_name = "expiresAt"
enabled = true
}
attribute {
name = "key"
type = "S"
Expand Down
8 changes: 8 additions & 0 deletions state/aws/dynamodb/dynamodb.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ func (d *StateStore) Init(_ context.Context, metadata state.Metadata) error {

// Features returns the features available in this state store.
func (d *StateStore) Features() []state.Feature {
// TTLs are enabled only if ttlAttributeName is set
if d.ttlAttributeName == "" {
return []state.Feature{
state.FeatureETag,
state.FeatureTransactional,
}
}

return []state.Feature{
state.FeatureETag,
state.FeatureTransactional,
Expand Down
4 changes: 3 additions & 1 deletion tests/config/state/aws/dynamodb/terraform/statestore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ spec:
- name: region
value: "us-east-1"
- name: table
value: ${{STATE_AWS_DYNAMODB_TABLE_1}}
value: ${{STATE_AWS_DYNAMODB_TABLE_1}}
- name: ttlAttributeName
value: "expiresAt"
3 changes: 2 additions & 1 deletion tests/config/state/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ components:
- component: in-memory
operations: [ "transaction", "etag", "first-write", "ttl" ]
- component: aws.dynamodb.docker
operations: [ "transaction", "etag", "first-write", "ttl" ]
# In the Docker variant, we do not set ttlAttributeName in the metadata, so TTLs are not enabled
operations: [ "transaction", "etag", "first-write" ]
- component: aws.dynamodb.terraform
operations: [ "transaction", "etag", "first-write", "ttl" ]
- component: etcd.v1
Expand Down

0 comments on commit fa715be

Please sign in to comment.