You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am attempting to validate that a bucket with access logging enabled is not pointing to itself as the target_bucket.
To Reproduce
Create an s3 bucket with a separate aws_s3_bucket_logging resource. Set the target_bucket to the same bucket you're creating. This is a terrible idea so don't apply it. Try to verify the value for "target_bucket" is not the same bucket you're creating.
Feature File:
Feature: S3 related general feature # check if at least one s3 has logging enabled, because logging will require another s3@noskip_at_line_21Scenario: S3 must have access logging enabled Given I have aws_s3_bucket defined
Given I have aws_s3_bucket_logging defined
Then it must have bucket
Then it must be in {aws_s3_bucket_logging.values.bucket}
@noskip_at_line_28Scenario: Data stored in S3 has versioning enabledGiven I have aws_s3_bucket defined
Given I have aws_s3_bucket_versioning defined
Then it must have bucket
Then it must be in {aws_s3_bucket_versioning.values.bucket}
@noskip_at_line_36Scenario: S3 access log must not log to itselfGiven I have aws_s3_bucket defined
Given I have aws_s3_bucket_logging defined
Then it must have target_bucket
Then it must not be in {aws_s3_bucket_logging.values.bucket}
Plan File:
# aws_s3_bucket.security_bucket will be created
+ resource "aws_s3_bucket" "security_bucket" {
+ acceleration_status = (known after apply)
+ acl = (known after apply)
+ arn = (known after apply)
+ bucket = "chhec-s3-access-log-bucket"
+ bucket_domain_name = (known after apply)
+ bucket_regional_domain_name = (known after apply)
+ force_destroy = false
+ hosted_zone_id = (known after apply)
+ id = (known after apply)
+ object_lock_enabled = (known after apply)
+ policy = (known after apply)
+ region = (known after apply)
+ request_payer = (known after apply)
+ tags_all = (known after apply)
+ website_domain = (known after apply)
+ website_endpoint = (known after apply)
# aws_s3_bucket_logging.security_access_log[0] will be created
+ resource "aws_s3_bucket_logging" "security_access_log" {
+ bucket = (known after apply)
+ id = (known after apply)
+ target_bucket = "chhec-s3-access-log-bucket"
+ target_prefix = "chhec-s3-access-log-bucket/"
}
Expected Behavior:
I would expect it to fail, but it succeeds:
Scenario: S3 access log must not log to itself
Given I have aws_s3_bucket defined
Given I have aws_s3_bucket_logging defined
Then it must have target_bucket
Then it must not be in {aws_s3_bucket_logging.values.bucket}
Tested Versions:
terraform-compliance version: 1.3.32
terraform version: 1.1.l7
python version: 3.10
Additional Context:
I just started using terraform-compliance and it's entirely likely I'm doing something wrong.
The text was updated successfully, but these errors were encountered:
Description
I am attempting to validate that a bucket with access logging enabled is not pointing to itself as the target_bucket.
To Reproduce
Create an s3 bucket with a separate aws_s3_bucket_logging resource. Set the target_bucket to the same bucket you're creating. This is a terrible idea so don't apply it. Try to verify the value for "target_bucket" is not the same bucket you're creating.
Feature File:
Plan File:
Sample Terraform Code:
Error Output:
Expected Behavior:
I would expect it to fail, but it succeeds:
Tested Versions:
1.3.32
1.1.l7
3.10
Additional Context:
I just started using terraform-compliance and it's entirely likely I'm doing something wrong.
The text was updated successfully, but these errors were encountered: