Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle renaming saved searches #286

Open
rasarn opened this issue Mar 21, 2024 · 1 comment · May be fixed by #287
Open

Handle renaming saved searches #286

rasarn opened this issue Mar 21, 2024 · 1 comment · May be fixed by #287

Comments

@rasarn
Copy link

rasarn commented Mar 21, 2024

Is your feature request related to a problem?

Yes.

Starting from version 1.5.1, more specifically since #274 was merged, we hit the error saved search name is immutable.

Describe the solution you'd like

We would expect that if the name changes, a new saved search is created with the new name, and the existing one is deleted.

Describe alternatives you've considered

We found a workaround by using the following:

resource "prismacloud_policy" "policy" {
  name = each.value.name
  ...

  for_each = local.policy_dict
}

resource "prismacloud_saved_search" "saved_search" {
  name = each.value.name
  ...

  for_each = local.policy_dict

  lifecycle {
    replace_triggered_by = [prismacloud_policy.policy[each.key].name]
  }
}

That way, when a name changes, a replacement of the saved search resource is triggered.
Still, it would be better if the resource handled this by itself.

Additional context

Within my company, we use this provider to manage our custom policies, and with each policy we also created a saved search with the same name, to help our colleagues to quickly find relevant queries when they use the Investigate tab.

We have a few hundreds custom policies, and sometimes some of them can get renamed for a variety of reasons: to make the name clearer, because the policy scope changed...

comrumino pushed a commit to comrumino/terraform-provider-prismacloud that referenced this issue Mar 30, 2024
…the name changes — copy & delete search as expected by user, but update would copy without deletion.
comrumino pushed a commit to comrumino/terraform-provider-prismacloud that referenced this issue Apr 1, 2024
…the name changes — copy & delete search as expected by user, but update would copy without deletion. Fixed PaloAltoNetworks#181 by introducing support for updating search queries and documenting the need for the lifecycle create_before_destroy to be true.
comrumino pushed a commit to comrumino/terraform-provider-prismacloud that referenced this issue Apr 1, 2024
…the name changes — copy & delete search as expected by user, but update would copy without deletion. Fixed PaloAltoNetworks#181 by introducing support for updating search queries and documenting the need for the lifecycle create_before_destroy to be true.
comrumino pushed a commit to comrumino/terraform-provider-prismacloud that referenced this issue Apr 1, 2024
…the name changes — copy & delete search as expected by user, but update would copy without deletion. Fixed PaloAltoNetworks#181 by introducing support for updating search queries and documenting the need for the lifecycle create_before_destroy to be true.
@comrumino
Copy link

I submitted a PR for this @rasarn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants