terraform-linters / tflint

A Pluggable Terraform Linter
Mozilla Public License 2.0
4.98k stars 357 forks source link

Can't pull the docker image #1888

Closed themathmagician closed 1 year ago

themathmagician commented 1 year ago

Summary

When I try to pull the docker image issuing this command: docker pull ghcr.io/terraform-linters/tflint:v0.48.0

Then I get the following error response:

Error response from daemon: Head "https://ghcr.io/v2/terraform-linters/tflint/manifests/v0.48.0": denied: denied

I would like to avoid a local install.

Command

docker run --rm -v $(pwd):/data ghcr.io/terraform-linters/tflint:v0.48.0

Terraform Configuration

terraform {
  required_version = "~> 1.5.7" # allows the patch version to change(fx security updates)

  cloud {
    organization = "xx"
    workspaces {
      //we use tagging strategy to be able to access remote terraform cloud workspaces.
      // another strategy is name, but we dont want to hardcode names, as we would like to create workspaces dynamically, pr pull request
      name = "bdd_spring_spike_dev"
    }
  }

  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = "3.76.0"
    }
  }
}

provider "azurerm" {
  features {}
  subscription_id = var.subscription_id
  client_id       = var.client_id
  client_secret   = var.client_secret
  tenant_id       = var.tenant_id
}

TFLint Configuration

config {
  module              = true
  disabled_by_default = false
  varfile = ["dev.tfvars", "prod.tfvars"]
}

plugin "azurerm" {
    enabled = true
    version = "0.14.0"
    source  = "github.com/terraform-linters/tflint-ruleset-azurerm"
}

# Disallow // comments in favor of #.
rule "terraform_comment_syntax" {
  enabled = true
}

# Disallow legacy dot index syntax.
rule "terraform_deprecated_index" {
  enabled = true
}

# Disallow deprecated (0.11-style) interpolation
rule "terraform_deprecated_interpolation" {
  enabled = true
}

# Disallow output declarations without description.
rule "terraform_documented_outputs" {
  enabled = true
}

# Disallow variable declarations without description.
rule "terraform_documented_variables" {
  enabled = true
}

# Disallow specifying a git or mercurial repository as a module source without pinning to a version.
rule "terraform_module_pinned_source" {
  enabled = true
}

rule "terraform_module_version" {
  enabled = true
  exact = false # default
}

# Require that all providers have version constraints through required_providers.
rule "terraform_required_providers" {
  enabled = true
}

# Disallow terraform declarations without require_version.
rule "terraform_required_version" {
  enabled = true
}

# Ensure that a module complies with the Terraform Standard Module Structure
rule "terraform_standard_module_structure" {
  enabled = true
}

# Disallow variable declarations without type.
rule "terraform_typed_variables" {
  enabled = true
}

# Disallow variables, data sources, and locals that are declared but never used.
rule "terraform_unused_declarations" {
  enabled = true
}

rule "terraform_unused_required_providers" {
  enabled = true
}

# terraform.workspace should not be used with a "remote" backend with remote execution.
rule "terraform_workspace_remote" {
  enabled = true
}

# Enforces naming conventions
rule "terraform_naming_convention" {
  enabled = true

  #Require specific naming structure
  variable {
  format = "snake_case"
  }

  locals {
  format = "snake_case"
  }

  output {
  format = "snake_case"
  }

  #Allow any format
  resource {
  format = "none"
  }

  module {
  format = "none"
  }

  data {
  format = "none"
  }
}

Output

no output as pull fails

TFLint Version

0.48.0

Terraform Version

1.5.7

Operating System

chenrui333 commented 1 year ago

I can just pull it fine

$ docker pull ghcr.io/terraform-linters/tflint:v0.48.0
v0.48.0: Pulling from terraform-linters/tflint
9fda8d8052c6: Already exists
3668a29655e1: Pull complete
862d94abe99a: Pull complete
85caccabc506: Pull complete
Digest: sha256:a720f001fb1085307f04aee66774902ad2beff3d6aa41a51ea335213d7409c9e
Status: Downloaded newer image for ghcr.io/terraform-linters/tflint:v0.48.0
ghcr.io/terraform-linters/tflint:v0.48.0
$ docker version
Client: Docker Engine - Community
 Version:           24.0.6
 API version:       1.41 (downgraded from 1.43)
 Go version:        go1.21.0
 Git commit:        ed223bc820
 Built:             Thu Aug 31 17:24:32 2023
 OS/Arch:           darwin/arm64
 Context:           colima
bendrucker commented 1 year ago

Same, this was either a transient error or perhaps you provided bad credentials (none are required)