Fix hostname config decoding for read-only data sources

This commit is contained in:
beatz174-bit committed 2026-04-23 12:41:06 +10:00
1 parent 9c15875568
commit 76722d39b2
3 files changed
+47 -6

No files matched your search

+3 -3
View File
@@ -73,9 +73,9 @@ func (d *domainDataSource) Configure(_ context.Context, req datasource.Configure
}
func (d *domainDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
var hostname types.String
resp.Diagnostics.Append(req.Config.GetAttribute(ctx, path.Root("hostname"), &hostname)...)
if resp.Diagnostics.HasError() {
hostname, err := hostnameFromConfig(req.Config)
if err != nil {
resp.Diagnostics.AddError("Unable to parse data source configuration", err.Error())
return
}