Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
bschaatsbergen opened this issue Jan 26, 2022 · 2 comments
Assignees
Labels
bug This issue is a bug. closed-for-staleness response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@bschaatsbergen
Copy link

bschaatsbergen commented Jan 26, 2022

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

  • get SDK version by printing the output of aws.SDKVersion in your code after importing "github.com/aws/aws-sdk-go/aws"

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",
@bschaatsbergen bschaatsbergen added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jan 26, 2022
@bschaatsbergen bschaatsbergen changed the title Only setting a field in the FieldSelector within a AdvancedEventSelector is possible, but shouldn't be. Omitting a operator in the AdvancedEventSelector.FieldSelector seems to be allowed but API throws a 400 Jan 26, 2022
@bschaatsbergen bschaatsbergen changed the title Omitting a operator in the AdvancedEventSelector.FieldSelector seems to be allowed but API throws a 400 Omitting a operator in the AdvancedEventSelector.FieldSelector seems to be allowed but API throws a 400 followed by a 500 Jan 26, 2022
@vudh1 vudh1 self-assigned this Mar 9, 2022
@vudh1
Copy link
Contributor

vudh1 commented Apr 29, 2022

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

@vudh1 vudh1 added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed needs-triage This issue or PR still needs to be triaged. labels Apr 29, 2022
@github-actions
Copy link

github-actions bot commented May 2, 2022

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.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels May 2, 2022
@github-actions github-actions bot closed this as completed May 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. closed-for-staleness response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

2 participants