Skip to content

Commit

Permalink
Merge pull request #4573 from terraform-providers/b-aws_dynamodb_tabl…
Browse files Browse the repository at this point in the history
…e-pitr-unsupportedoperation

resource/aws_dynamodb_table: Handle UnknownOperationException with DescribeContinuousBackups
  • Loading branch information
bflad authored May 23, 2018
2 parents 3112fef + 55f422e commit 1c0f6fa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion aws/resource_aws_dynamodb_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ func resourceAwsDynamoDbTableRead(d *schema.ResourceData, meta interface{}) erro
pitrOut, err := conn.DescribeContinuousBackups(&dynamodb.DescribeContinuousBackupsInput{
TableName: aws.String(d.Id()),
})
if err != nil {
if err != nil && !isAWSErr(err, "UnknownOperationException", "") {
return err
}
d.Set("point_in_time_recovery", flattenDynamoDbPitr(pitrOut))
Expand Down
12 changes: 8 additions & 4 deletions aws/structure.go
Original file line number Diff line number Diff line change
Expand Up @@ -3697,16 +3697,20 @@ func flattenDynamoDbTtl(ttlDesc *dynamodb.TimeToLiveDescription) []interface{} {
}

func flattenDynamoDbPitr(pitrDesc *dynamodb.DescribeContinuousBackupsOutput) []interface{} {
m := map[string]interface{}{}
m := map[string]interface{}{
"enabled": false,
}

if pitrDesc == nil {
return []interface{}{m}
}

if pitrDesc.ContinuousBackupsDescription != nil {
pitr := pitrDesc.ContinuousBackupsDescription.PointInTimeRecoveryDescription
if pitr != nil {
m["enabled"] = (*pitr.PointInTimeRecoveryStatus == dynamodb.PointInTimeRecoveryStatusEnabled)
}
}
if len(m) > 0 {
return []interface{}{m}
}

return []interface{}{m}
}
Expand Down

0 comments on commit 1c0f6fa

Please sign in to comment.