@@ -122,7 +122,7 @@ func (d *datadogServiceAccountDatasource) Read(ctx context.Context, req datasour
122
122
if resp .Diagnostics .HasError () {
123
123
return
124
124
}
125
- var userData * datadogV2.User
125
+ var userData datadogV2.User
126
126
if ! state .ID .IsNull () {
127
127
serviceAccountID := state .ID .ValueString ()
128
128
ddResp , _ , err := d .Api .GetUser (d .Auth , serviceAccountID )
@@ -135,7 +135,7 @@ func (d *datadogServiceAccountDatasource) Read(ctx context.Context, req datasour
135
135
resp .Diagnostics .AddError ("Obtained entity was not a service account" , "" )
136
136
return
137
137
}
138
- userData = ddResp .Data
138
+ userData = * ddResp .Data
139
139
} else {
140
140
optionalParams := datadogV2.ListUsersOptionalParameters {}
141
141
filter := state .Filter .ValueString ()
@@ -166,17 +166,17 @@ func (d *datadogServiceAccountDatasource) Read(ctx context.Context, req datasour
166
166
resp .Diagnostics .AddError ("filter keyword returned no results" , "" )
167
167
return
168
168
}
169
- userData = & serviceAccounts [0 ]
169
+ userData = serviceAccounts [0 ]
170
170
if isExactMatch {
171
171
matchCount := 0
172
172
for _ , serviceAccount := range serviceAccounts {
173
173
if * serviceAccount .GetAttributes ().Email == filter {
174
- userData = & serviceAccount
174
+ userData = serviceAccount
175
175
matchCount ++
176
176
continue
177
177
}
178
178
if * serviceAccount .GetAttributes ().Name .Get () == filter {
179
- userData = & serviceAccount
179
+ userData = serviceAccount
180
180
matchCount ++
181
181
continue
182
182
}
@@ -191,7 +191,7 @@ func (d *datadogServiceAccountDatasource) Read(ctx context.Context, req datasour
191
191
}
192
192
}
193
193
}
194
- d .updateState (ctx , & state , userData )
194
+ d .updateState (ctx , & state , & userData )
195
195
resp .Diagnostics .Append (resp .State .Set (ctx , & state )... )
196
196
}
197
197
0 commit comments