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

Rule ordering in panos_security_rule_group #119

Open
dga-nagra opened this issue Jul 23, 2024 · 0 comments
Open

Rule ordering in panos_security_rule_group #119

dga-nagra opened this issue Jul 23, 2024 · 0 comments
Labels

Comments

@dga-nagra
Copy link

Describe the bug

panos_security_rule_group

Rule ordering is left to hazard when the order of the rules matters a lot.
The order blocks like

rule {
    ...
}

are passed to the provider is not defined. In the same way, the for_each attributes does not guarantee any ordering.

Expected behavior

There must be an explicit way to order the rules in this resource.

Current behavior

Rule ordering is left to hazard.

Possible solution

There are 2 ways of defining this:

  1. Keep a block definition and add a priority/index field (mandatory)

     rule {
         priority = 1
     }

    This would imply less changes, but this solution is not really suited here. It makes sense for modules like terraform-aws-modules/alb/aws that create separate objects under the hood. Since the objects are in fact created individually, they need an index. In this situation, this resource should instead be split in 2 different resources (and maybe provide a module for simplification)

  2. Use a list of rules instead of a block

    panos_security_rule_group {
        rules = [
                {
                    name = "Deny everything else"
                    # ...
                }
        ]
    }

    This is the recommended way to define attributes when the order matters.

Steps to reproduce

Screenshots

Context

Your Environment

  • Version used: 1.11.1 (of the terraform provider)

  • Environment name and version (e.g. Chrome 59, node.js 5.4, python 3.7.3): terraform 1.6.6 and 1.8.5

  • Operating System and version (desktop or mobile): Linux

  • Link to your project: -

@dga-nagra dga-nagra added the bug label Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant