aws / aws-sdk-go

AWS SDK for the Go programming language.
http://aws.amazon.com/sdk-for-go/
Apache License 2.0
8.64k stars 2.07k forks source link

Omitting a operator in the AdvancedEventSelector.FieldSelector seems to be allowed but API throws a 400 followed by a 500 #4260

Closed bschaatsbergen closed 2 years ago

bschaatsbergen commented 2 years ago

Confirm by changing [ ] to [x] below to ensure that it's a bug:

Describe the bug When trying to create a EventDataStore, I add a AdvancedEventSelector containing a FieldSelector. If I only set the Field and omit one of the operators (equals, starts with, etc) it seems to be accepted by the func (s *CreateEventDataStoreInput) Validate() but throws an error implicitly (400) when calling the API.

Version of AWS SDK for Go? v1.42.38

Version of Go (go version)? go version go1.17.6 linux/amd64

To Reproduce (observed behavior) Steps to reproduce the behavior (please share code or minimal repo)

Try to create a event data store including a AdvancedEventSelector that omits any operator (just set the Field property)

Expected behavior

I would expect to not receive a retryable 400, but either the validation failing or a 400 that isn't being retried.

Additional context

The documentation clearly shows that a field should always be used together with an operator: https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-data-events-with-cloudtrail.html#read-write-events-data

Trace from event history:

"userAgent": "APN/1.0 HashiCorp/1.0 Terraform/1.1.3 (+https://www.terraform.io) terraform-provider-aws/dev (+https://registry.terraform.io/providers/hashicorp/aws) aws-sdk-go/1.42.38 (go1.17.6; linux; amd64)",
    "errorCode": "InternalFailure",
    "errorMessage": "An unknown error occurred",
    "requestParameters": {
        "name": "tf-test-store-11",
        "advancedEventSelectors": [
            {
                "name": "Test",
                "fieldSelectors": [
                    {
                        "field": "eventCategory"
                    }
                ]
            }
        ],
        "multiRegionEnabled": false,
        "organizationEnabled": false,
        "retentionPeriod": 11,
        "terminationProtectionEnabled": false
    },
    "responseElements": null,
    "requestID": "8cd45dac-3df9-47a9-952b-3392aea70a0e",
    "eventID": "909146fa-3b8d-4248-8769-0f5e38597580",
vudh1 commented 2 years ago

Hi, is this still persisting with the latest version of SDK?

github-actions[bot] commented 2 years ago

This issue has not received a response in 1 week. If you want to keep this issue open, please just leave a comment below and auto-close will be canceled.