mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 16:33:21 +01:00
fix(terraform): parse provider lock entries without constraints (#3934)
In a .terraform.lock.hcl file in a provider block the `constraints` attribute is actually not required (=optional). Signed-off-by: Thomas Gosteli <thomas.gosteli@protonmail.ch>
This commit is contained in:
parent
bbf3bb5856
commit
684e1e963d
@ -59,7 +59,7 @@ func TestTerraformCataloger(t *testing.T) {
|
|||||||
Metadata: pkg.TerraformLockProviderEntry{
|
Metadata: pkg.TerraformLockProviderEntry{
|
||||||
URL: "registry.terraform.io/hashicorp/google",
|
URL: "registry.terraform.io/hashicorp/google",
|
||||||
Version: "6.8.0",
|
Version: "6.8.0",
|
||||||
Constraints: "6.8.0",
|
Constraints: "",
|
||||||
Hashes: []string{
|
Hashes: []string{
|
||||||
"h1:GlCaVPk6eKMg2ZbRY7C5tUeHGNIABT+qFtMl8+XWZHM=",
|
"h1:GlCaVPk6eKMg2ZbRY7C5tUeHGNIABT+qFtMl8+XWZHM=",
|
||||||
"zh:1b78f4451f1617092eb6891c9c13eda79671060601c40947feea6794c732157a",
|
"zh:1b78f4451f1617092eb6891c9c13eda79671060601c40947feea6794c732157a",
|
||||||
|
|||||||
@ -26,7 +26,6 @@ provider "registry.terraform.io/hashicorp/aws" {
|
|||||||
|
|
||||||
provider "registry.terraform.io/hashicorp/google" {
|
provider "registry.terraform.io/hashicorp/google" {
|
||||||
version = "6.8.0"
|
version = "6.8.0"
|
||||||
constraints = "6.8.0"
|
|
||||||
hashes = [
|
hashes = [
|
||||||
"h1:GlCaVPk6eKMg2ZbRY7C5tUeHGNIABT+qFtMl8+XWZHM=",
|
"h1:GlCaVPk6eKMg2ZbRY7C5tUeHGNIABT+qFtMl8+XWZHM=",
|
||||||
"zh:1b78f4451f1617092eb6891c9c13eda79671060601c40947feea6794c732157a",
|
"zh:1b78f4451f1617092eb6891c9c13eda79671060601c40947feea6794c732157a",
|
||||||
|
|||||||
@ -3,7 +3,7 @@ package pkg
|
|||||||
// TerraformLockProviderEntry represents a single provider entry in a Terraform dependency lock file (.terraform.lock.hcl).
|
// TerraformLockProviderEntry represents a single provider entry in a Terraform dependency lock file (.terraform.lock.hcl).
|
||||||
type TerraformLockProviderEntry struct {
|
type TerraformLockProviderEntry struct {
|
||||||
URL string `hcl:",label" json:"url"`
|
URL string `hcl:",label" json:"url"`
|
||||||
Constraints string `hcl:"constraints" json:"constraints"`
|
Constraints string `hcl:"constraints,optional" json:"constraints"`
|
||||||
Version string `hcl:"version" json:"version"`
|
Version string `hcl:"version" json:"version"`
|
||||||
Hashes []string `hcl:"hashes" json:"hashes"`
|
Hashes []string `hcl:"hashes" json:"hashes"`
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user