Skip to content

terraform.aws.best-practice.aws-s3-bucket-versioning-not-enabled.aws-s3-bucket-versioning-not-enabled has false positive on v5+ of the Terraform provider for AWS #3497

Open
@nint8835

Description

Describe the bug
The rule terraform.aws.best-practice.aws-s3-bucket-versioning-not-enabled.aws-s3-bucket-versioning-not-enabled checks for object versioning being enabled based on the versioning block in the aws_s3_bucket resource being configured.

However, as of v5 of the Terraform provider, many configurations that once were blocks within the main aws_s3_bucket resource had separate resources created for them, with the block method deprecated, and this includes versioning. As a result, enabling versioning via a non-deprecated means will result in a false positive. This may also impact other rules related to S3 that are impacted by this change.

To Reproduce

resource "aws_s3_bucket" "example" {
  bucket = "example-bucket"
}

resource "aws_s3_bucket_versioning" "versioning_example" {
  bucket = aws_s3_bucket.example.id
  versioning_configuration {
    status = "Enabled"
  }
}

Expected behavior
A bucket with versioning enabled via aws_s3_bucket_versioning should not trigger a false positive saying versioning isn't configured.

Priority
How important is this to you?

  • P0: blocking me from making progress
  • P1: this will block me in the near future
  • P2: annoying but not blocking me

Additional Context
Add any other context about the problem here.

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions