@@ -196,7 +196,7 @@ func resourceChronicleRuleDeploymentCreate(d *schema.ResourceData, meta interfac
196196 obj ["runFrequency" ] = runFrequencyProp
197197 }
198198
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" )
200200 if err != nil {
201201 return err
202202 }
@@ -216,6 +216,23 @@ func resourceChronicleRuleDeploymentCreate(d *schema.ResourceData, meta interfac
216216 }
217217
218218 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+ }
219236 res , err := transport_tpg .SendRequest (transport_tpg.SendRequestOptions {
220237 Config : config ,
221238 Method : "PATCH" ,
0 commit comments