Skip to content

Commit

Permalink
Add support for count/each value
Browse files Browse the repository at this point in the history
  • Loading branch information
wata727 committed Oct 10, 2022
1 parent fce5684 commit 8bc3b9e
Show file tree
Hide file tree
Showing 16 changed files with 958 additions and 238 deletions.
20 changes: 20 additions & 0 deletions integrationtest/inspection/conditional/result.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,26 @@
},
"callers": []
},
{
"rule": {
"name": "aws_instance_example_type",
"severity": "error",
"link": ""
},
"message": "instance type is t2.micro",
"range": {
"filename": "template.tf",
"start": {
"line": 61,
"column": 19
},
"end": {
"line": 61,
"column": 29
}
},
"callers": []
},
{
"rule": {
"name": "aws_iam_policy_example",
Expand Down
108 changes: 108 additions & 0 deletions integrationtest/inspection/module/result.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,114 @@
}
}
]
},
{
"rule": {
"name": "aws_instance_example_type",
"severity": "error",
"link": ""
},
"message": "instance type is t1.4xlarge",
"range": {
"filename": "module.tf",
"start": {
"line": 21,
"column": 12
},
"end": {
"line": 21,
"column": 16
}
},
"callers": [
{
"filename": "module.tf",
"start": {
"line": 21,
"column": 12
},
"end": {
"line": 21,
"column": 16
}
},
{
"filename": "module/template.tf",
"start": {
"line": 15,
"column": 12
},
"end": {
"line": 15,
"column": 22
}
},
{
"filename": "module/module/instance.tf",
"start": {
"line": 9,
"column": 19
},
"end": {
"line": 9,
"column": 62
}
}
]
},
{
"rule": {
"name": "aws_instance_example_type",
"severity": "error",
"link": ""
},
"message": "instance type is t1.4xlarge",
"range": {
"filename": "module.tf",
"start": {
"line": 22,
"column": 19
},
"end": {
"line": 22,
"column": 27
}
},
"callers": [
{
"filename": "module.tf",
"start": {
"line": 22,
"column": 19
},
"end": {
"line": 22,
"column": 27
}
},
{
"filename": "module/template.tf",
"start": {
"line": 16,
"column": 19
},
"end": {
"line": 16,
"column": 36
}
},
{
"filename": "module/module/instance.tf",
"start": {
"line": 9,
"column": 19
},
"end": {
"line": 9,
"column": 62
}
}
]
}
],
"errors": []
Expand Down
108 changes: 108 additions & 0 deletions integrationtest/inspection/module/result_windows.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,114 @@
}
}
]
},
{
"rule": {
"name": "aws_instance_example_type",
"severity": "error",
"link": ""
},
"message": "instance type is t1.4xlarge",
"range": {
"filename": "module.tf",
"start": {
"line": 21,
"column": 12
},
"end": {
"line": 21,
"column": 16
}
},
"callers": [
{
"filename": "module.tf",
"start": {
"line": 21,
"column": 12
},
"end": {
"line": 21,
"column": 16
}
},
{
"filename": "module\\template.tf",
"start": {
"line": 15,
"column": 12
},
"end": {
"line": 15,
"column": 22
}
},
{
"filename": "module\\module\\instance.tf",
"start": {
"line": 9,
"column": 19
},
"end": {
"line": 9,
"column": 62
}
}
]
},
{
"rule": {
"name": "aws_instance_example_type",
"severity": "error",
"link": ""
},
"message": "instance type is t1.4xlarge",
"range": {
"filename": "module.tf",
"start": {
"line": 22,
"column": 19
},
"end": {
"line": 22,
"column": 27
}
},
"callers": [
{
"filename": "module.tf",
"start": {
"line": 22,
"column": 19
},
"end": {
"line": 22,
"column": 27
}
},
{
"filename": "module\\template.tf",
"start": {
"line": 16,
"column": 19
},
"end": {
"line": 16,
"column": 36
}
},
{
"filename": "module\\module\\instance.tf",
"start": {
"line": 9,
"column": 19
},
"end": {
"line": 9,
"column": 62
}
}
]
}
],
"errors": []
Expand Down
2 changes: 1 addition & 1 deletion plugin/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func (s *GRPCServer) EvaluateExpr(expr hcl.Expression, opts sdk.EvaluateExprOpti
runner = s.rootRunner
}

val, diags := runner.Ctx.EvaluateExpr(expr, *opts.WantType)
val, diags := runner.Ctx.EvaluateExpr(expr, *opts.WantType, terraform.EvalDataForNoInstanceKey)
if diags.HasErrors() {
return val, diags
}
Expand Down
Loading

0 comments on commit 8bc3b9e

Please sign in to comment.