Skip to content

Commit

Permalink
Fix DataSource Read() for Exhaustive
Browse files Browse the repository at this point in the history
  • Loading branch information
kklimonda-cl committed Aug 16, 2024
1 parent 56ee162 commit e170c11
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/translate/terraform_provider/funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2051,13 +2051,18 @@ func DataSourceReadFunction(resourceTyp properties.ResourceType, names *NameProv

var tmpl string
var listAttribute string
var exhaustive bool
switch resourceTyp {
case properties.ResourceEntry:
tmpl = resourceReadFunction
case properties.ResourceEntryPlural:
tmpl = resourceReadEntryListFunction
listAttribute = pascalCase(paramSpec.TerraformProviderConfig.PluralName)
case properties.ResourceUuid, properties.ResourceUuidPlural:
case properties.ResourceUuid:
exhaustive = true
tmpl = resourceReadManyFunction
listAttribute = pascalCase(paramSpec.TerraformProviderConfig.PluralName)
case properties.ResourceUuidPlural:
tmpl = resourceReadManyFunction
listAttribute = pascalCase(paramSpec.TerraformProviderConfig.PluralName)
}
Expand All @@ -2076,6 +2081,7 @@ func DataSourceReadFunction(resourceTyp properties.ResourceType, names *NameProv
"ResourceOrDS": "DataSource",
"ResourceIsMap": resourceIsMap,
"HasEncryptedResources": paramSpec.HasEncryptedResources(),
"Exhaustive": exhaustive,
"ListAttribute": listAttributeVariant,
"EntryOrConfig": paramSpec.EntryOrConfig(),
"HasEntryName": paramSpec.HasEntryName(),
Expand Down

0 comments on commit e170c11

Please sign in to comment.