@@ -196,7 +196,7 @@ func resourceChronicleRuleDeploymentCreate(d *schema.ResourceData, meta interfac
196
196
obj ["runFrequency" ] = runFrequencyProp
197
197
}
198
198
199
- url , err := tpgresource .ReplaceVars (d , config , "{{ChronicleBasePath}}projects/{{project}}/locations/{{location}}/instances/{{instance}}/rules/{{rule}}/deployment?updateMask=enabled,alerting,archived,runFrequency " )
199
+ url , err := tpgresource .ReplaceVars (d , config , "{{ChronicleBasePath}}projects/{{project}}/locations/{{location}}/instances/{{instance}}/rules/{{rule}}/deployment" )
200
200
if err != nil {
201
201
return err
202
202
}
@@ -216,6 +216,23 @@ func resourceChronicleRuleDeploymentCreate(d *schema.ResourceData, meta interfac
216
216
}
217
217
218
218
headers := make (http.Header )
219
+ // Read the config and update the mask only if set by the user in terraform code
220
+
221
+ params := []string {"enabled" , "alerting" , "archived" , "run_frequency" }
222
+ var existingParams []string
223
+
224
+ // Populating existingParams with the params that exist
225
+ for _ , param := range params {
226
+ if _ , ok := d .GetOk (param ); ok {
227
+ existingParams = append (existingParams , param )
228
+ }
229
+ }
230
+
231
+ // Updating the url to have updateMask
232
+ url , err = transport_tpg .AddQueryParams (url , map [string ]string {"updateMask" : strings .Join (existingParams , "," )})
233
+ if err != nil {
234
+ return err
235
+ }
219
236
res , err := transport_tpg .SendRequest (transport_tpg.SendRequestOptions {
220
237
Config : config ,
221
238
Method : "PATCH" ,
0 commit comments