Skip to content

Commit

Permalink
Location required on the json results (#959)
Browse files Browse the repository at this point in the history
The vscode plugin needs the location block on the json results to drive
the treeview - quickest dirtiest way to do it
  • Loading branch information
Owen Rumney committed Jul 27, 2021
1 parent caa9830 commit ff1bf69
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions example/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ resource "aws_api_gateway_domain_name" "valid_security_policy" {
security_policy = "TLS_1_2"
}

#tfsec:ignore:AWS092
resource "aws_dynamodb_table" "bad_example" {
name = "example"
hash_key = "TestTableHashKey"
Expand Down
5 changes: 4 additions & 1 deletion pkg/result/result.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type Result struct {
RangeAnnotation string `json:"-"`
Severity severity.Severity `json:"severity"`
Status Status `json:"status"`
Location block.Range `json:"location"`
blocks block.Blocks
attribute block.Attribute
}
Expand All @@ -38,10 +39,12 @@ const (
)

func New(resourceBlock block.Block) *Result {
return &Result{
result := &Result{
Status: Failed,
blocks: []block.Block{resourceBlock},
}
result.Location = result.Range()
return result
}

func (r *Result) Passed() bool {
Expand Down

0 comments on commit ff1bf69

Please sign in to comment.