Merge pull request #3300 from Runscope/fix-dynamodb-gsi-bug

provider/aws: fix bug with reading GSIs from dynamodb
This commit is contained in:
Clint 2015-10-15 10:04:33 -05:00
commit 2f94e575ef
1 changed files with 12 additions and 3 deletions

View File

@ -575,14 +575,23 @@ func resourceAwsDynamoDbTableRead(d *schema.ResourceData, meta interface{}) erro
}
}
gsi["projection_type"] = *gsiObject.Projection.ProjectionType
gsi["non_key_attributes"] = gsiObject.Projection.NonKeyAttributes
gsi["projection_type"] = *(gsiObject.Projection.ProjectionType)
nonKeyAttrs := make([]string, 0, len(gsiObject.Projection.NonKeyAttributes))
for _, nonKeyAttr := range gsiObject.Projection.NonKeyAttributes {
nonKeyAttrs = append(nonKeyAttrs, *nonKeyAttr)
}
gsi["non_key_attributes"] = nonKeyAttrs
gsiList = append(gsiList, gsi)
log.Printf("[DEBUG] Added GSI: %s - Read: %d / Write: %d", gsi["name"], gsi["read_capacity"], gsi["write_capacity"])
}
d.Set("global_secondary_index", gsiList)
err = d.Set("global_secondary_index", gsiList)
if err != nil {
return err
}
d.Set("arn", table.TableArn)
return nil