Skip to content

Commit 13f6911

Browse files
committed
add json tag
1 parent c6db0b6 commit 13f6911

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

extract/preset.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func PresetFromBlock(block *terraform.Block) (tfPreset types.Preset) {
6565

6666
prebuildBlock := block.GetBlock("prebuilds")
6767
if prebuildBlock != nil {
68-
p.Prebuild = &types.PrebuildData{
68+
p.Prebuilds = &types.PrebuildData{
6969
// Invalid values will be set to 0
7070
Instances: int(optionalInteger(prebuildBlock, "instances")),
7171
}

preview.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ func (o Output) MarshalJSON() ([]byte, error) {
7979
func ValidatePrebuilds(ctx context.Context, input Input, preValid []types.Preset, dir fs.FS) {
8080
for i := range preValid {
8181
pre := &preValid[i]
82-
if pre.Prebuild == nil || pre.Prebuild.Instances <= 0 {
82+
if pre.Prebuilds == nil || pre.Prebuilds.Instances <= 0 {
8383
// No prebuilds, so presets do not need to be valid without user input
8484
continue
8585
}
@@ -232,7 +232,7 @@ func Preview(ctx context.Context, input Input, dir fs.FS) (output *Output, diagn
232232
diags := make(hcl.Diagnostics, 0)
233233
rp, rpDiags := parameters(modules)
234234
// preValidPresets are extracted as written in terraform. Each individual
235-
// param value is checked, however the preset as a whole might not valid.
235+
// param value is checked, however, the preset as a whole might not be valid.
236236
preValidPresets := presets(modules, rp)
237237
tags, tagDiags := workspaceTags(modules, p.Files())
238238
vars := variables(modules)

preview_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -950,11 +950,11 @@ func (a assertPreset) def(def bool) assertPreset {
950950

951951
func (a assertPreset) prebuildCount(exp int) assertPreset {
952952
return a.extend(func(t *testing.T, preset types.Preset) {
953-
if exp == 0 && preset.Prebuild == nil {
953+
if exp == 0 && preset.Prebuilds == nil {
954954
return
955955
}
956-
require.NotNilf(t, preset.Prebuild, "prebuild should not be nil, expected %d instances", exp)
957-
require.Equal(t, exp, preset.Prebuild.Instances)
956+
require.NotNilf(t, preset.Prebuilds, "prebuild should not be nil, expected %d instances", exp)
957+
require.Equal(t, exp, preset.Prebuilds.Instances)
958958
})
959959
}
960960

types/preset.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ type PresetData struct {
1919
Name string `json:"name"`
2020
Parameters map[string]string `json:"parameters"`
2121
Default bool `json:"default"`
22-
Prebuild *PrebuildData
22+
Prebuilds *PrebuildData `json:"prebuilds,omitempty"`
2323
}

0 commit comments

Comments
 (0)