Skip to content

Commit

Permalink
Merge pull request #7497 from ewbankkit/issue-7496
Browse files Browse the repository at this point in the history
d/aws_dynamodb_table: Add missing 'billing_mode' and 'point_in_time_recovery' attributes
  • Loading branch information
bflad committed Feb 12, 2019
2 parents 0f8b146 + 75291b0 commit c23e4c8
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
25 changes: 25 additions & 0 deletions aws/data_source_aws_dynamodb_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,23 @@ func dataSourceAwsDynamoDbTable() *schema.Resource {
},
},
},
"billing_mode": {
Type: schema.TypeString,
Computed: true,
},
"point_in_time_recovery": {
Type: schema.TypeList,
Computed: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"enabled": {
Type: schema.TypeBool,
Computed: true,
},
},
},
},
},
}
}
Expand Down Expand Up @@ -222,5 +239,13 @@ func dataSourceAwsDynamoDbTableRead(d *schema.ResourceData, meta interface{}) er
}
d.Set("tags", tags)

pitrOut, err := conn.DescribeContinuousBackups(&dynamodb.DescribeContinuousBackupsInput{
TableName: aws.String(d.Id()),
})
if err != nil && !isAWSErr(err, "UnknownOperationException", "") {
return err
}
d.Set("point_in_time_recovery", flattenDynamoDbPitr(pitrOut))

return nil
}
3 changes: 3 additions & 0 deletions aws/data_source_aws_dynamodb_table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ func TestAccDataSourceAwsDynamoDbTable_basic(t *testing.T) {
resource.TestCheckResourceAttr("data.aws_dynamodb_table.dynamodb_table_test", "tags.Name", "dynamodb-table-1"),
resource.TestCheckResourceAttr("data.aws_dynamodb_table.dynamodb_table_test", "tags.Environment", "test"),
resource.TestCheckResourceAttr("data.aws_dynamodb_table.dynamodb_table_test", "server_side_encryption.#", "0"),
resource.TestCheckResourceAttr("data.aws_dynamodb_table.dynamodb_table_test", "billing_mode", "PROVISIONED"),
resource.TestCheckResourceAttr("data.aws_dynamodb_table.dynamodb_table_test", "point_in_time_recovery.#", "1"),
resource.TestCheckResourceAttr("data.aws_dynamodb_table.dynamodb_table_test", "point_in_time_recovery.0.enabled", "false"),
),
},
},
Expand Down

0 comments on commit c23e4c8

Please sign in to comment.