Skip to content

Commit 35b2c89

Browse files
Ivan De Marinodetro
authored andcommitted
Bugfix: Ensure we don't set HasExample and HasImport unless the file actually exists
1 parent 45633dd commit 35b2c89

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

internal/provider/template.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,16 +130,11 @@ func (t providerTemplate) Render(providerName, renderedProviderName, exampleFile
130130
return "", nil
131131
}
132132
return renderStringTemplate("providerTemplate", s, struct {
133-
Type string
134-
Name string
135133
Description string
136134

137135
HasExample bool
138136
ExampleFile string
139137

140-
HasImport bool
141-
ImportFile string
142-
143138
ProviderName string
144139
ProviderShortName string
145140

@@ -195,10 +190,10 @@ func (t resourceTemplate) Render(name, providerName, renderedProviderName, typeN
195190
Name: name,
196191
Description: schema.Block.Description,
197192

198-
HasExample: exampleFile != "",
193+
HasExample: exampleFile != "" && fileExists(exampleFile),
199194
ExampleFile: exampleFile,
200195

201-
HasImport: importFile != "",
196+
HasImport: importFile != "" && fileExists(importFile),
202197
ImportFile: importFile,
203198

204199
ProviderName: providerName,

0 commit comments

Comments
 (0)