mirror of
https://github.com/aquasecurity/trivy.git
synced 2025-12-22 07:10:41 -08:00
fix(misconf): add ephemeral block type to config schema (#8513)
Signed-off-by: nikpivkin <nikita.pivkin@smartforce.io>
This commit is contained in:
@@ -2393,7 +2393,6 @@ resource "aws_s3_bucket" "example" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
parser := New(fsys, "", OptionStopOnHCLError(true))
|
parser := New(fsys, "", OptionStopOnHCLError(true))
|
||||||
|
|
||||||
require.NoError(t, parser.ParseFS(t.Context(), "."))
|
require.NoError(t, parser.ParseFS(t.Context(), "."))
|
||||||
|
|
||||||
_, err := parser.Load(t.Context())
|
_, err := parser.Load(t.Context())
|
||||||
@@ -2405,3 +2404,17 @@ resource "aws_s3_bucket" "example" {
|
|||||||
val := modules.GetResourcesByType("aws_s3_bucket")[0].GetAttribute("bucket").GetRawValue()
|
val := modules.GetResourcesByType("aws_s3_bucket")[0].GetAttribute("bucket").GetRawValue()
|
||||||
assert.Nil(t, val)
|
assert.Nil(t, val)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestConfigWithEphemeralBlock(t *testing.T) {
|
||||||
|
fsys := fstest.MapFS{
|
||||||
|
"main.tf": &fstest.MapFile{Data: []byte(`ephemeral "random_password" "password" {
|
||||||
|
length = 16
|
||||||
|
}`)},
|
||||||
|
}
|
||||||
|
|
||||||
|
parser := New(fsys, "", OptionStopOnHCLError(true))
|
||||||
|
require.NoError(t, parser.ParseFS(t.Context(), "."))
|
||||||
|
|
||||||
|
_, err := parser.Load(t.Context())
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
|||||||
@@ -42,6 +42,10 @@ var Schema = &hcl.BodySchema{
|
|||||||
Type: "data",
|
Type: "data",
|
||||||
LabelNames: []string{"type", "name"},
|
LabelNames: []string{"type", "name"},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Type: "ephemeral",
|
||||||
|
LabelNames: []string{"type", "name"},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
Type: "moved",
|
Type: "moved",
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user