Skip to content

Commit 29dee32

Browse files
authored
feat(terraform): ignore resources by nested attributes (aquasecurity#6302)
1 parent 1a67472 commit 29dee32

File tree

3 files changed

+354
-123
lines changed

3 files changed

+354
-123
lines changed

docs/docs/scanner/misconfiguration/index.md

+15-2
Original file line numberDiff line numberDiff line change
@@ -494,8 +494,21 @@ resource "aws_security_group_rule" "example" {
494494
}
495495
```
496496

497-
!!! note
498-
Currently nested attributes are not supported. For example you will not be able to reference the `each.key` attribute.
497+
Checks can also be ignored by nested attributes, but certain restrictions apply:
498+
499+
- You cannot access an individual block using indexes, for example when working with dynamic blocks.
500+
- Special variables like [each](https://developer.hashicorp.com/terraform/language/meta-arguments/for_each#the-each-object) and [count](https://developer.hashicorp.com/terraform/language/meta-arguments/count#the-count-object) cannot be accessed.
501+
502+
```tf
503+
#trivy:ignore:*[logging_config.prefix=myprefix]
504+
resource "aws_cloudfront_distribution" "example" {
505+
logging_config {
506+
include_cookies = false
507+
bucket = "mylogs.s3.amazonaws.com"
508+
prefix = "myprefix"
509+
}
510+
}
511+
```
499512

500513
#### Ignoring module issues
501514

0 commit comments

Comments
 (0)