hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.81k stars 9.16k forks source link

Documentation bug: aws_guardduty_filter should say that spaces are not allowed in name #19893

Closed fzipi360 closed 1 year ago

fzipi360 commented 3 years ago

Community Note

Terraform CLI and Terraform AWS Provider Version

Affected Resource(s)

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

data "aws_guardduty_detector" "org" {}

resource "aws_guardduty_filter" "test_remove_from_tor" {
  name        = "Access using AWS Public keys from Tor IPs"
  action      = "ARCHIVE"
  detector_id = data.aws_guardduty_detector.org.id
  rank        = 1

  finding_criteria {
    criterion {
      field  = "type"
      equals = ["UnauthorizedAccess:S3/TorIPCaller"]
    }

    criterion {
      field  = "resource.s3BucketDetails.name"
      equals = ["we-dont-care-about-this-one"]
    }

    criterion {
      field                 = "severity"
      greater_than_or_equal = "4"
    }
  }
}

Debug Output

Panic Output

Expected Behavior

aws guardduty filter created.

Actual Behavior

Fails with:

❯ terraform apply "gd.plan"
...
β”‚ Error: error creating GuardDuty Filter: InternalServerErrorException: The request is rejected because an invalid or out-of-range value is specified as an input parameter.
β”‚ {
β”‚   RespMetadata: {
β”‚     StatusCode: 400,
β”‚     RequestID: "70563976-046f-4840-a52a-57b247d83e25"
β”‚   },
β”‚   Message_: "The request is rejected because an invalid or out-of-range value is specified as an input parameter.",
β”‚   Type: "InvalidInputException"
β”‚ }
β”‚
β”‚   with aws_guardduty_filter.archive_public_keys_from_tor,
β”‚   on guardduty.tf line 18, in resource "aws_guardduty_filter" "test_remove_from_tor":
β”‚  18: resource "aws_guardduty_filter" "test_remove_from_tor" {

Didn't knew what the problem was until reviewing all the documentation and finding that spaces aren't allowed in the name :(

Steps to Reproduce

  1. terraform apply

Important Factoids

API documentation states that:

--name (string)

    The name of the filter. Minimum length of 3. Maximum length of 64. Valid characters include alphanumeric characters, dot (.), underscore (_), and dash (-). Spaces are not allowed.

References

github-actions[bot] commented 1 year ago

Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.

If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!

github-actions[bot] commented 1 year ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.