@@ -157,9 +157,7 @@ func resourceArmCognitiveAccountCreate(d *schema.ResourceData, meta interface{})
157
157
Location : utils .String (azure .NormalizeLocation (d .Get ("location" ).(string ))),
158
158
Sku : sku ,
159
159
Properties : & cognitiveservices.AccountProperties {
160
- APIProperties : & cognitiveservices.AccountAPIProperties {
161
- QnaRuntimeEndpoint : utils .String (d .Get ("qna_runtime_endpoint" ).(string )),
162
- },
160
+ APIProperties : & cognitiveservices.AccountAPIProperties {},
163
161
},
164
162
Tags : tags .Expand (d .Get ("tags" ).(map [string ]interface {})),
165
163
}
@@ -168,6 +166,10 @@ func resourceArmCognitiveAccountCreate(d *schema.ResourceData, meta interface{})
168
166
return fmt .Errorf ("the QnAMaker runtime endpoint `qna_runtime_endpoint` is required when kind is set to `QnAMaker`" )
169
167
}
170
168
169
+ if v , ok := d .GetOk ("qna_runtime_endpoint" ); ok {
170
+ props .Properties .APIProperties .QnaRuntimeEndpoint = utils .String (v .(string ))
171
+ }
172
+
171
173
if _ , err := client .Create (ctx , resourceGroup , name , props ); err != nil {
172
174
return fmt .Errorf ("Error creating Cognitive Services Account %q (Resource Group %q): %+v" , name , resourceGroup , err )
173
175
}
@@ -200,9 +202,7 @@ func resourceArmCognitiveAccountUpdate(d *schema.ResourceData, meta interface{})
200
202
props := cognitiveservices.Account {
201
203
Sku : sku ,
202
204
Properties : & cognitiveservices.AccountProperties {
203
- APIProperties : & cognitiveservices.AccountAPIProperties {
204
- QnaRuntimeEndpoint : utils .String (d .Get ("qna_runtime_endpoint" ).(string )),
205
- },
205
+ APIProperties : & cognitiveservices.AccountAPIProperties {},
206
206
},
207
207
Tags : tags .Expand (d .Get ("tags" ).(map [string ]interface {})),
208
208
}
@@ -211,6 +211,10 @@ func resourceArmCognitiveAccountUpdate(d *schema.ResourceData, meta interface{})
211
211
return fmt .Errorf ("the QnAMaker runtime endpoint `qna_runtime_endpoint` is required when kind is set to `QnAMaker`" )
212
212
}
213
213
214
+ if v , ok := d .GetOk ("qna_runtime_endpoint" ); ok {
215
+ props .Properties .APIProperties .QnaRuntimeEndpoint = utils .String (v .(string ))
216
+ }
217
+
214
218
if _ , err = client .Update (ctx , id .ResourceGroup , id .Name , props ); err != nil {
215
219
return fmt .Errorf ("Error updating Cognitive Services Account %q (Resource Group %q): %+v" , id .Name , id .ResourceGroup , err )
216
220
}
0 commit comments