terraform-linters / tflint

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

Unable to verify PGP signature of plugin #1788

Closed bodgit closed 1 year ago

bodgit commented 1 year ago

Summary

I've used your ruleset template to create a plugin hosted in our private GitHub enterprise account. With a bit of tweaking, I've gotten the release workflow to correctly build and publish the binaries along with the checksums, with GPG being used, such that my release has the following assets:

I've then added an additional plugin {} block to .tflint.hcl along with the GPG public key, however when I run tflint --init it errors with Failed to install a plugin; Failed to check checksums.txt signature: openpgp: invalid argument: no armored data found.

If I don't set signing_key then the plugin installs but complains that I should ideally set signing_key.

I'm not sure what I'm doing wrong as I've pretty much followed your ruleset template repo. I've checked your aws plugin releases and your checksums.txt and checksums.txt.sig are of a similar format, I just don't have the checksums.txt.pem and checksums.txt.keyless.sig as I'm not using cosign which I presume creates these.

Command

GITHUB_TOKEN=... tflint --init

Terraform Configuration

n/a

TFLint Configuration

plugin "terraform" {
  enabled = true
  preset  = "all"
}

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

plugin "custom" {
  enabled = true

  version = "1.0.0"
  source  = "github.com/Org/tflint-ruleset-custom"

  signing_key = <<-KEY
  -----BEGIN PGP PUBLIC KEY BLOCK-----
  ...
  -----END PGP PUBLIC KEY BLOCK-----
  KEY
}

Output

Plugin `aws` is already installed
Installing `custom` plugin...
Failed to install a plugin; Failed to check checksums.txt signature: openpgp: invalid argument: no armored data found

TFLint Version

0.47.0

Terraform Version

No response

Operating System

bodgit commented 1 year ago

Fixed the issue, I had somehow removed the blank line between -----BEGIN PGP PUBLIC KEY BLOCK----- and the start of the key data in the heredoc. Added the blank line back and it now works correctly.

Apologies for the noise.