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

AC_AWS_0214 not backward compatible #1172

Closed
HorizonNet opened this issue Feb 27, 2022 · 0 comments · Fixed by #1173
Closed

AC_AWS_0214 not backward compatible #1172

HorizonNet opened this issue Feb 27, 2022 · 0 comments · Fixed by #1173

Comments

@HorizonNet
Copy link
Contributor

  • terrascan version: master
  • Operating System: MacOS

Description

The changes made in #1153 to introduce S3 bucket versioning capabilities for provider version 4.0.0 broke the behavior for provider versions before 4.0.0, such as 3.74.0 of hashicorp/aws. Now inline definitions of the bucket versioning are reported as violations.

What I Did

The following definition is versioning-enabled based on provider version 3.74.0 and was not reported as a violation for AC_AWS_0214 before #1153.

resource "aws_s3_bucket" "example" {
  bucket = "example"
  acl    = "private"

  versioning {
    enabled    = true
    mfa_delete = true
  }
}

Running the current master against this file via

./bin/terrascan scan -f main.tf -p terrascan/pkg/policies/opa/rego

returns the following result

Violation Details -

    Description    :        Enabling S3 versioning will enable easy recovery from both unintended user actions, like deletes and overwrites
    File           :        main.tf
    Module Name    :        root
    Line           :        5
    Severity       :        HIGH
    -----------------------------------------------------------------------

Scan Summary -

    File/Folder         :   main.tf
    IaC Type            :   terraform
    Scanned At          :   2022-02-27 14:59:11.976481 +0000 UTC
    Policies Validated  :   14
    Violated Policies   :   1
    Low                 :   0
    Medium              :   0
    High                :   1
harkirat22 pushed a commit that referenced this issue Feb 28, 2022
Add a backward compatible implementation of AC_AWS_0214, which also
works for provider versions before 4.0.0.

Resolves #1172
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant