Skip to content

Commit

Permalink
Merge pull request hashicorp#1316 from joshuaspence/s3panic
Browse files Browse the repository at this point in the history
Fix a panic
  • Loading branch information
radeksimko authored Aug 3, 2017
2 parents 23967fb + 0b1c68a commit e8185f2
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions aws/resource_aws_s3_bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -784,21 +784,24 @@ func resourceAwsS3BucketRead(d *schema.ResourceData, meta interface{}) error {
rule["id"] = *lifecycleRule.ID
}
filter := lifecycleRule.Filter
if filter.And != nil {
// Prefix
if filter.And.Prefix != nil && *filter.And.Prefix != "" {
rule["prefix"] = *filter.And.Prefix
}
// Tag
if len(filter.And.Tags) > 0 {
rule["tags"] = tagsToMapS3(filter.And.Tags)
}
} else {
// Prefix
if filter.Prefix != nil && *filter.Prefix != "" {
rule["prefix"] = *filter.Prefix
if filter != nil {
if filter.And != nil {
// Prefix
if filter.And.Prefix != nil && *filter.And.Prefix != "" {
rule["prefix"] = *filter.And.Prefix
}
// Tag
if len(filter.And.Tags) > 0 {
rule["tags"] = tagsToMapS3(filter.And.Tags)
}
} else {
// Prefix
if filter.Prefix != nil && *filter.Prefix != "" {
rule["prefix"] = *filter.Prefix
}
}
}

// Enabled
if lifecycleRule.Status != nil {
if *lifecycleRule.Status == s3.ExpirationStatusEnabled {
Expand Down

0 comments on commit e8185f2

Please sign in to comment.