-
Notifications
You must be signed in to change notification settings - Fork 358
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
1,634 additions
and
998 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
plugin "testing" { | ||
enabled = true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
variable "unknown_set" { | ||
type = set(bool) | ||
} | ||
|
||
variable "unknown_bool" { | ||
type = bool | ||
} | ||
|
||
resource "aws_s3_bucket" "main" { | ||
lifecycle_rule { | ||
enabled = true | ||
} | ||
|
||
dynamic "lifecycle_rule" { | ||
for_each = var.unknown_set | ||
|
||
content { | ||
enabled = lifecycle_rule.value | ||
} | ||
} | ||
|
||
dynamic "lifecycle_rule" { | ||
for_each = toset([var.unknown_bool]) | ||
|
||
content { | ||
enabled = lifecycle_rule.value | ||
} | ||
} | ||
} | ||
|
||
resource "aws_iam_role" "main" { | ||
inline_policy { | ||
name = "static" | ||
} | ||
|
||
dynamic "inline_policy" { | ||
for_each = toset(["foo", "bar"]) | ||
|
||
content { | ||
name = inline_policy.value | ||
} | ||
} | ||
|
||
dynamic "inline_policy" { | ||
for_each = var.unknown_set | ||
|
||
content { | ||
name = inline_policy.value | ||
} | ||
} | ||
} | ||
|
||
resource "testing_assertions" "main" { | ||
equal "static" {} | ||
|
||
dynamic "equal" { | ||
for_each = toset(["known_label"]) | ||
iterator = it | ||
labels = [it.value] | ||
content {} | ||
} | ||
|
||
dynamic "equal" { | ||
for_each = toset(["unknown_label"]) | ||
iterator = it | ||
labels = ["${it.value}-${var.unknown_bool}"] | ||
content {} | ||
} | ||
} |
145 changes: 145 additions & 0 deletions
145
integrationtest/inspection/dynblock-unknown/result.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
{ | ||
"issues": [ | ||
{ | ||
"rule": { | ||
"name": "aws_s3_bucket_example_lifecycle_rule", | ||
"severity": "error", | ||
"link": "" | ||
}, | ||
"message": "`lifecycle_rule` block found", | ||
"range": { | ||
"filename": "main.tf", | ||
"start": { | ||
"line": 10, | ||
"column": 3 | ||
}, | ||
"end": { | ||
"line": 10, | ||
"column": 17 | ||
} | ||
}, | ||
"callers": [] | ||
}, | ||
{ | ||
"rule": { | ||
"name": "aws_s3_bucket_example_lifecycle_rule", | ||
"severity": "error", | ||
"link": "" | ||
}, | ||
"message": "`enabled` attribute found: true", | ||
"range": { | ||
"filename": "main.tf", | ||
"start": { | ||
"line": 11, | ||
"column": 15 | ||
}, | ||
"end": { | ||
"line": 11, | ||
"column": 19 | ||
} | ||
}, | ||
"callers": [] | ||
}, | ||
{ | ||
"rule": { | ||
"name": "aws_s3_bucket_example_lifecycle_rule", | ||
"severity": "error", | ||
"link": "" | ||
}, | ||
"message": "`lifecycle_rule` block found", | ||
"range": { | ||
"filename": "main.tf", | ||
"start": { | ||
"line": 22, | ||
"column": 3 | ||
}, | ||
"end": { | ||
"line": 22, | ||
"column": 27 | ||
} | ||
}, | ||
"callers": [] | ||
}, | ||
{ | ||
"rule": { | ||
"name": "aws_iam_role_example", | ||
"severity": "error", | ||
"link": "" | ||
}, | ||
"message": "inline policy found", | ||
"range": { | ||
"filename": "main.tf", | ||
"start": { | ||
"line": 32, | ||
"column": 3 | ||
}, | ||
"end": { | ||
"line": 32, | ||
"column": 16 | ||
} | ||
}, | ||
"callers": [] | ||
}, | ||
{ | ||
"rule": { | ||
"name": "aws_iam_role_example", | ||
"severity": "error", | ||
"link": "" | ||
}, | ||
"message": "name is static", | ||
"range": { | ||
"filename": "main.tf", | ||
"start": { | ||
"line": 33, | ||
"column": 12 | ||
}, | ||
"end": { | ||
"line": 33, | ||
"column": 20 | ||
} | ||
}, | ||
"callers": [] | ||
}, | ||
{ | ||
"rule": { | ||
"name": "testing_assertions_example", | ||
"severity": "error", | ||
"link": "" | ||
}, | ||
"message": "equal block found: label=static", | ||
"range": { | ||
"filename": "main.tf", | ||
"start": { | ||
"line": 54, | ||
"column": 3 | ||
}, | ||
"end": { | ||
"line": 54, | ||
"column": 17 | ||
} | ||
}, | ||
"callers": [] | ||
}, | ||
{ | ||
"rule": { | ||
"name": "testing_assertions_example", | ||
"severity": "error", | ||
"link": "" | ||
}, | ||
"message": "equal block found: label=known_label", | ||
"range": { | ||
"filename": "main.tf", | ||
"start": { | ||
"line": 56, | ||
"column": 3 | ||
}, | ||
"end": { | ||
"line": 56, | ||
"column": 18 | ||
} | ||
}, | ||
"callers": [] | ||
} | ||
], | ||
"errors": [] | ||
} |
Oops, something went wrong.