@@ -295,48 +295,10 @@ func (r *namespaceSearchAttributeResource) Update(ctx context.Context, req resou
295295}
296296
297297func (r * namespaceSearchAttributeResource ) Delete (ctx context.Context , req resource.DeleteRequest , resp * resource.DeleteResponse ) {
298- var state namespaceSearchAttributeModel
299- resp .Diagnostics .Append (req .State .Get (ctx , & state )... )
300- if resp .Diagnostics .HasError () {
301- return
302- }
303-
304- withNamespaceLock (state .NamespaceID .ValueString (), func () {
305- ns , err := r .client .CloudService ().GetNamespace (ctx , & cloudservicev1.GetNamespaceRequest {
306- Namespace : state .NamespaceID .ValueString (),
307- })
308- if err != nil {
309- resp .Diagnostics .AddError ("Failed to get namespace" , err .Error ())
310- return
311- }
312-
313- spec := ns .GetNamespace ().GetSpec ()
314- _ , ok := spec .GetSearchAttributes ()[state .Name .ValueString ()]
315- if ! ok {
316- // search attribute is already deleted
317- resp .Diagnostics .AddWarning ("Custom search attribute was already deleted" , state .ID .String ())
318- return
319- }
320-
321- // delete the search attribute
322- delete (spec .SearchAttributes , state .Name .ValueString ())
323-
324- svcResp , err := r .client .CloudService ().UpdateNamespace (ctx , & cloudservicev1.UpdateNamespaceRequest {
325- Namespace : state .NamespaceID .ValueString (),
326- Spec : spec ,
327- ResourceVersion : ns .GetNamespace ().GetResourceVersion (),
328- AsyncOperationId : uuid .New ().String (),
329- })
330- if err != nil {
331- resp .Diagnostics .AddError ("Failed delete search attribute" , err .Error ())
332- return
333- }
334-
335- if err := client .AwaitAsyncOperation (ctx , r .client , svcResp .GetAsyncOperation ()); err != nil {
336- resp .Diagnostics .AddError ("Failed delete search attribute" , err .Error ())
337- return
338- }
339- })
298+ resp .Diagnostics .AddWarning (
299+ "Delete Ignored" ,
300+ "The Temporal Cloud API does not support deleting a search attribute. Terraform will silently drop this resource but will not delete it from the Temporal Cloud namespace." ,
301+ )
340302}
341303
342304func (r * namespaceSearchAttributeResource ) ImportState (ctx context.Context , req resource.ImportStateRequest , resp * resource.ImportStateResponse ) {
0 commit comments