Skip to content

Commit

Permalink
generate: Fixed bug where resource type with same name as provider ov…
Browse files Browse the repository at this point in the history
…erwrites all other documentation files
  • Loading branch information
austinvalle committed Nov 18, 2024
1 parent 5b55bcc commit a50a29d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions internal/provider/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,15 @@ func removeAllExt(file string) string {
// has either the providerShortName or the providerShortName concatenated with the
// templateFileName (stripped of file extension.
func resourceSchema(schemas map[string]*tfjson.Schema, providerShortName, templateFileName string) (*tfjson.Schema, string) {
if schema, ok := schemas[providerShortName]; ok {
return schema, providerShortName
}

resName := providerShortName + "_" + removeAllExt(templateFileName)

if schema, ok := schemas[resName]; ok {
return schema, resName
}

if schema, ok := schemas[providerShortName]; ok {
return schema, providerShortName
}

return nil, resName
}

Expand Down

0 comments on commit a50a29d

Please sign in to comment.