Skip to content

Commit

Permalink
[ignore] Move up a few lines the default parentDn setting in datasour…
Browse files Browse the repository at this point in the history
…ce template.
  • Loading branch information
gmicol committed May 15, 2024
1 parent f9a524e commit d89c71c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions gen/templates/datasource.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ func (d *{{.ResourceClassName}}DataSource) Read(ctx context.Context, req datasou
return
}

{{ if getDefaultValues .PkgName "parent_dn" $.Definitions}}
if data.ParentDn.IsNull() || data.ParentDn.IsUnknown(){
data.ParentDn = basetypes.NewStringValue("{{getDefaultValues .PkgName "parent_dn" $.Definitions}}")
}
{{- end}}

set{{.ResourceClassName}}Id(ctx, data)

// Create a copy of the Id for when not found during getAndSet{{.ResourceClassName}}Attributes
Expand All @@ -145,12 +151,6 @@ func (d *{{.ResourceClassName}}DataSource) Read(ctx context.Context, req datasou

getAndSet{{.ResourceClassName}}Attributes(ctx, &resp.Diagnostics, d.client, data)

{{ if getDefaultValues .PkgName "parent_dn" $.Definitions}}
if data.ParentDn.IsNull() || data.ParentDn.IsUnknown(){
data.ParentDn = basetypes.NewStringValue("{{getDefaultValues .PkgName "parent_dn" $.Definitions}}")
}
{{- end}}

if data.Id.IsNull() {
resp.Diagnostics.AddError(
"Failed to read aci_{{.ResourceName}} data source",
Expand Down
8 changes: 4 additions & 4 deletions internal/provider/data_source_aci_netflow_monitor_policy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d89c71c

Please sign in to comment.