Skip to content

Commit 41512f8

Browse files
authored
fix(misconf): add ephemeral block type to config schema (#8513)
Signed-off-by: nikpivkin <[email protected]>
1 parent 0e5e909 commit 41512f8

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

pkg/iac/scanners/terraform/parser/parser_test.go

+14-1
Original file line numberDiff line numberDiff line change
@@ -2393,7 +2393,6 @@ resource "aws_s3_bucket" "example" {
23932393
}
23942394

23952395
parser := New(fsys, "", OptionStopOnHCLError(true))
2396-
23972396
require.NoError(t, parser.ParseFS(t.Context(), "."))
23982397

23992398
_, err := parser.Load(t.Context())
@@ -2405,3 +2404,17 @@ resource "aws_s3_bucket" "example" {
24052404
val := modules.GetResourcesByType("aws_s3_bucket")[0].GetAttribute("bucket").GetRawValue()
24062405
assert.Nil(t, val)
24072406
}
2407+
2408+
func TestConfigWithEphemeralBlock(t *testing.T) {
2409+
fsys := fstest.MapFS{
2410+
"main.tf": &fstest.MapFile{Data: []byte(`ephemeral "random_password" "password" {
2411+
length = 16
2412+
}`)},
2413+
}
2414+
2415+
parser := New(fsys, "", OptionStopOnHCLError(true))
2416+
require.NoError(t, parser.ParseFS(t.Context(), "."))
2417+
2418+
_, err := parser.Load(t.Context())
2419+
require.NoError(t, err)
2420+
}

pkg/iac/terraform/schema.go

+4
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ var Schema = &hcl.BodySchema{
4242
Type: "data",
4343
LabelNames: []string{"type", "name"},
4444
},
45+
{
46+
Type: "ephemeral",
47+
LabelNames: []string{"type", "name"},
48+
},
4549
{
4650
Type: "moved",
4751
},

0 commit comments

Comments
 (0)