providers/aws: Read S3 website config

This commit is contained in:
Justin Campbell 2015-05-06 08:12:40 -04:00
parent 20e531ae0d
commit eeb65b8d4c
1 changed files with 15 additions and 0 deletions

View File

@ -123,6 +123,21 @@ func resourceAwsS3BucketRead(d *schema.ResourceData, meta interface{}) error {
}
}
// Read the website configuration
ws, err := s3conn.GetBucketWebsite(&s3.GetBucketWebsiteInput{
Bucket: aws.String(d.Id()),
})
var websites []map[string]interface{}
if err == nil {
websites = append(websites, map[string]interface{}{
"index_document": *ws.IndexDocument.Suffix,
"error_document": *ws.ErrorDocument.Key,
})
}
if err := d.Set("website", websites); err != nil {
return err
}
// Add website_endpoint as an output
endpoint, err := websiteEndpoint(s3conn, d)
if err != nil {