Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/blocks/blockreader.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,12 @@ func (bv blockVisitor) Visit(cursor *astutil.Cursor) bool {
return true
}

// Includes matching Go format verbs in the resource, data source, variable, or output name.
// Includes matching Go format verbs in the resource, data source, list, variable, or output name.
// Technically, this is only valid for the Go matcher, but included generally for simplicity.
var terraformMatcher = regexp.MustCompile(`(((resource|data)\s+"[-a-z0-9_]+")|(variable|output))\s+"[-a-zA-Z0-9_%\[\]]+"\s+\{`)
var terraformMatcher = regexp.MustCompile(`(((resource|data|list)\s+"[-a-z0-9_]+")|(variable|output))\s+"[-a-zA-Z0-9_%\[\]]+"\s+\{`)

// A simple check to see if the content looks like a Terraform configuration.
// Looks for a line with either a resource, data source, variable, or output declaration
// Looks for a line with either a resource, data source, list, variable, or output declaration
func looksLikeTerraform(s string) bool {
return terraformMatcher.MatchString(s)
}
Expand Down
12 changes: 12 additions & 0 deletions lib/blocks/blockreader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,18 @@ data "aws_s3_bucket" "simple-data" {
},
{
text: `
list "azurerm_resource_group" "example" {
provider = azurerm

config {
filter = "tagName eq 'query' and tagValue eq 'example'"
}
}
`,
expected: true,
},
{
text: `
variable "name" {
type = string
}`,
Expand Down
Loading