PaloAltoNetworks / terraform-provider-panos

Terraform Panos provider
https://www.terraform.io/docs/providers/panos/
Mozilla Public License 2.0
87 stars 69 forks source link

panos_ip_tag - changing tags results in unexpected behavior #347

Open rukntwsb opened 1 year ago

rukntwsb commented 1 year ago

Adding a new tag to panos_ip_tag results in removal of existing registration, and re-addition of tag. That should not happen. New tag can be added to an IP address without removing existing. panos_ip_tag does also not respect the lifecycle stanza. problem with all this is that if a tag if tag is changed, and there are multiple tags, the plan will be wrong at apply time, and the only way to fix it is to re-run the plan over and over again.

If the object is slated for deletion, then all tags need to be reapplied at creation. Not just the one that was missing.

terraform version 1.2.4 PANOS provider version: 1.10.3 PANOS Version: 10.1

To test: resource "panos_ip_tag" "ip_tag" { ip = "1.2.3.4" tags = ["tag1","tag2","tag3"]

lifecycle {
    create_before_destroy = false
}

}

Change the object to: resource "panos_ip_tag" "ip_tag" { ip = "1.2.3.4" tags = ["tag1","tag4","tag3"]

lifecycle {
    create_before_destroy = false
}

}

Observe the issue.

welcome-to-palo-alto-networks[bot] commented 1 year ago

:tada: Thanks for opening your first issue here! Welcome to the community!