fix(misconf): add ephemeral block type to config schema (#8513)

Signed-off-by: nikpivkin <nikita.pivkin@smartforce.io>
This commit is contained in:
Nikita Pivkin
2025-03-11 06:23:41 +06:00
committed by GitHub
parent 0e5e909765
commit 41512f846e
2 changed files with 18 additions and 1 deletions

View File

@@ -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)
}

View File

@@ -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",
}, },