Skip to content

terraform_module_pinned_source rule emits unclear error for un-parseable URL #1196

Closed
@mjneuharth

Description

We have an project in AzureDevops which was created with a space in the name, "My Project". When referencing repos within that project, tflint fails on the pinned_source rule, seemingly misreading the end of line.

For this bit of terraform,

module "rg" {
  source   = "git::https://myorg:#{ terraformAzureDevOpsPAT }#@dev.azure.com/myorg/My%20Project/_git/terraform-az-rg?ref=0.1.0"
  name     = "rg-${local.application}-${var.environment}-${var.fpbuild_id}"
  location = var.location
  tags     = local.default_tags
}

We see this error message,

2021-08-24 13:01:40 [ERROR]   Found errors in [tflint] linter!
2021-08-24 13:01:40 [ERROR]   Error code: 3. Command output:
------
1 issue(s) found:

Warning: Module source "git::https://myorg:#{ terraformAzureDevOpsPAT }#@dev.azure.com/myorg/My%!P(MISSING)roject/_git/terraform-az-rg?ref=0.1.0" is not pinned (terraform_module_pinned_source)

  on /tmp/lint/main.tf line 2:
   2:   source   = "git::https://myorg:#{ terraformAzureDevOpsPAT }#@dev.azure.com/myorg/My%20Plus/_git/terraform-az-rg?ref=0.1.0"

Reference: https://github.com/terraform-linters/tflint/blob/v0.31.0/docs/rules/terraform_module_pinned_source.md

Version

> tflint -v
TFLint version 0.31.0
> terraform -v
Terraform v0.14.10

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