Skip to content

Terrascan fails to load .tf files that contain provider functions #1736

@folksgl

Description

@folksgl

Terrascan does not seem to be able to properly parse .tf files that utilize Terraform Provider Functions. The following causes error cli/run.go:141 scan run failed{error 26 0 failed to load iac file

# Uses the azurerm provider function provider::azurerm::parse_resource_id(id).
# The user must either not provide a log analytics ID, or it must pass the provider function parsing to be valid.
variable "log_analytics_workspace_id" {
  type        = string
  description = "The ID of the Azure Log Analytics workspace where diagnostic logs will be sent."
  default     = null
  validation {
    condition     = var.log_analytics_workspace_id == null || can(provider::azurerm::parse_resource_id(var.log_analytics_workspace_id))
    error_message = "Provided Log Analytics Workspace ID could not be parsed. Please ensure you provide the full resource ID."
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions