Skip to content

Commit a90dcdc

Browse files
committed
update routing_rules to TypeList
1 parent 7e9a771 commit a90dcdc

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

internal/service/s3/bucket_website_configuration.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func ResourceBucketWebsiteConfiguration() *schema.Resource {
8989
},
9090
},
9191
"routing_rule": {
92-
Type: schema.TypeSet,
92+
Type: schema.TypeList,
9393
Optional: true,
9494
Elem: &schema.Resource{
9595
Schema: map[string]*schema.Schema{
@@ -167,8 +167,8 @@ func resourceBucketWebsiteConfigurationCreate(ctx context.Context, d *schema.Res
167167
websiteConfig.RedirectAllRequestsTo = expandS3BucketWebsiteConfigurationRedirectAllRequestsTo(v.([]interface{}))
168168
}
169169

170-
if v, ok := d.GetOk("routing_rule"); ok && v.(*schema.Set).Len() > 0 {
171-
websiteConfig.RoutingRules = expandS3BucketWebsiteConfigurationRoutingRules(v.(*schema.Set).List())
170+
if v, ok := d.GetOk("routing_rule"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil {
171+
websiteConfig.RoutingRules = expandS3BucketWebsiteConfigurationRoutingRules(v.([]interface{}))
172172
}
173173

174174
input := &s3.PutBucketWebsiteInput{
@@ -270,8 +270,8 @@ func resourceBucketWebsiteConfigurationUpdate(ctx context.Context, d *schema.Res
270270
websiteConfig.RedirectAllRequestsTo = expandS3BucketWebsiteConfigurationRedirectAllRequestsTo(v.([]interface{}))
271271
}
272272

273-
if v, ok := d.GetOk("routing_rule"); ok && v.(*schema.Set).Len() > 0 {
274-
websiteConfig.RoutingRules = expandS3BucketWebsiteConfigurationRoutingRules(v.(*schema.Set).List())
273+
if v, ok := d.GetOk("routing_rule"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil {
274+
websiteConfig.RoutingRules = expandS3BucketWebsiteConfigurationRoutingRules(v.([]interface{}))
275275
}
276276

277277
input := &s3.PutBucketWebsiteInput{

website/docs/r/s3_bucket_website_configuration.html.markdown

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ The following arguments are supported:
4444
* `expected_bucket_owner` - (Optional, Forces new resource) The account ID of the expected bucket owner.
4545
* `index_document` - (Optional, Required if `redirect_all_requests_to` is not specified) The name of the index document for the website [detailed below](#index_document).
4646
* `redirect_all_requests_to` - (Optional, Required if `index_document` is not specified) The redirect behavior for every request to this bucket's website endpoint [detailed below](#redirect_all_requests_to). Conflicts with `error_document`, `index_document`, and `routing_rule`.
47-
* `routing_rule` - (Optional, Conflicts with `redirect_all_requests_to`) Set of rules that define when a redirect is applied and the redirect behavior [detailed below](#routing_rule).
47+
* `routing_rule` - (Optional, Conflicts with `redirect_all_requests_to`) List of rules that define when a redirect is applied and the redirect behavior [detailed below](#routing_rule).
4848

4949
### error_document
5050

0 commit comments

Comments
 (0)