@@ -871,7 +871,12 @@ func resourceAwsS3BucketWebsiteUpdate(s3conn *s3.S3, d *schema.ResourceData) err
871871 ws := d .Get ("website" ).([]interface {})
872872
873873 if len (ws ) == 1 {
874- w := ws [0 ].(map [string ]interface {})
874+ var w map [string ]interface {}
875+ if ws [0 ] != nil {
876+ w = ws [0 ].(map [string ]interface {})
877+ } else {
878+ w = make (map [string ]interface {})
879+ }
875880 return resourceAwsS3BucketWebsitePut (s3conn , d , w )
876881 } else if len (ws ) == 0 {
877882 return resourceAwsS3BucketWebsiteDelete (s3conn , d )
@@ -883,10 +888,19 @@ func resourceAwsS3BucketWebsiteUpdate(s3conn *s3.S3, d *schema.ResourceData) err
883888func resourceAwsS3BucketWebsitePut (s3conn * s3.S3 , d * schema.ResourceData , website map [string ]interface {}) error {
884889 bucket := d .Get ("bucket" ).(string )
885890
886- indexDocument := website ["index_document" ].(string )
887- errorDocument := website ["error_document" ].(string )
888- redirectAllRequestsTo := website ["redirect_all_requests_to" ].(string )
889- routingRules := website ["routing_rules" ].(string )
891+ var indexDocument , errorDocument , redirectAllRequestsTo , routingRules string
892+ if v , ok := website ["index_document" ]; ok {
893+ indexDocument = v .(string )
894+ }
895+ if v , ok := website ["error_document" ]; ok {
896+ errorDocument = v .(string )
897+ }
898+ if v , ok := website ["redirect_all_requests_to" ]; ok {
899+ redirectAllRequestsTo = v .(string )
900+ }
901+ if v , ok := website ["routing_rules" ]; ok {
902+ routingRules = v .(string )
903+ }
890904
891905 if indexDocument == "" && redirectAllRequestsTo == "" {
892906 return fmt .Errorf ("Must specify either index_document or redirect_all_requests_to." )
0 commit comments