Rule ordering in panos_security_rule_group
Describe the bug
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:
-
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)
-
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: -