Archived
Fix hostname config decoding for read-only data sources
This commit is contained in:
1 parent
9c15875568
commit
76722d39b2
3 files changed
+47
-6
No files matched your search
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user