Skip to content

panos_syslog_profile cannot manage syslog profiles that are located in shared on an unmanaged firewall. #524

@fciarfella-immobiliare

Description

@fciarfella-immobiliare

Describe the bug

panos_syslog_profile cannot manage syslog profiles that are located in shared on an unmanaged firewall.

This is inconsistent with:

  • PAN-OS behavior, where syslog profiles on a standalone firewall are stored under shared log-settings syslog
  • the generic provider location guide, which documents location = { shared = {} } for common objects

However, the panos_syslog_profile resource schema does not expose location.shared, so there is currently no way to represent a standalone firewall syslog profile in its real location.

Expected behavior

panos_syslog_profile should support location = { shared = {} } for unmanaged firewalls and operate on the correct XPath:

config/shared/log-settings/syslog

This should also work for:

  • terraform import
  • terraform plan
  • terraform apply

so that an existing shared syslog profile can be represented in Terraform without drift.

Current behavior

panos_syslog_profile only supports these locations in its resource schema:

  • panorama
  • vsys
  • template
  • template_vsys
  • template_stack
  • template_stack_vsys

There is no shared location for this resource.

Because of that:

  • the real location of the object on the firewall cannot be expressed
  • using vsys as a workaround is not valid for a shared object

Example workaround failure:

resource "panos_syslog_profile" "lms_infra" {
  location = {
    vsys = {
      ngfw_device = "localhost.localdomain"
      name        = "shared"
    }
  }

  name = "lms-infra"
}

This fails with:

failed to create entry on the server: shared 'shared' is invalid. vsys name should begin with 'vsys'

Possible solution

Add shared support for panos_syslog_profile in both:

  • pango device/profiles/syslog/location.go
  • provider internal/provider/syslog_profile.go

This looks similar to how shared is already implemented for other resources, for example panos_ssl_tls_service_profile.

Concretely, this likely means:

  • adding SharedLocation to the syslog profile location model in pango
  • mapping it to config/shared/log-settings/syslog
  • exposing location.shared in the Terraform resource schema
  • updating import/marshal/unmarshal logic accordingly
  • aligning the resource docs with the generic location guide

Steps to reproduce

  1. Use provider paloaltonetworks/panos version 2.0.9 against an unmanaged firewall.
  2. Verify that the syslog profile exists in shared, for example:
show shared log-settings syslog lms-infra
  1. Try to model it with panos_syslog_profile using its real location:
resource "panos_syslog_profile" "lms_infra" {
  location = {
    shared = {}
  }

  name = "lms-infra"
}
  1. Observe that shared is not supported by the resource schema, and any attempt to force the object into vsys fails because the real object is not a vsys-scoped object.

Screenshots

Relevant error when trying the vsys workaround:

failed to create entry on the server: shared 'shared' is invalid. vsys name should begin with 'vsys'

Context

I am trying to recreate the existing firewall configuration in Terraform so that terraform plan/apply is a no-op.

For standalone firewalls, syslog profiles are actually stored in shared, so without location.shared support in panos_syslog_profile there is no faithful way to import/manage these objects. This prevents representing the real device configuration and introduces unavoidable drift.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions