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

Add set definition from Hiera #24

Closed
LionelCons opened this issue Nov 26, 2020 · 3 comments · Fixed by #26
Closed

Add set definition from Hiera #24

LionelCons opened this issue Nov 26, 2020 · 3 comments · Fixed by #26

Comments

@LionelCons
Copy link

Currently, rules can be defined in Hiera. This is very good.

The same should be done for sets, for symmetry purposes and to be able to define in Hiera rules that depend on sets.

It seems that the following addition to init.pp should be enough:

  $sets.each |$n,$v| {
    nftables::set{
      $n:
        * => $v
    }
  }

@nbarrientos
Copy link
Collaborator

I could implement this but I'd personally actually do the opposite. I'd remove nftables::rules (the parameter). Users wanting to provide rules or sets via Hiera can do so today by using create_resources()

@duritong
Copy link
Collaborator

duritong commented Nov 26, 2020

create_resources was a workaround for what @LionelCons proposes back in the day when the splat operator and looping did not yet exist.
It comes with multiple problems. E.g. no linenumber and manifests file reference where it was created and thus problems with such resources are hard to debug.

Since the language has loops and the splat operator, this is the way to go. Also how can they create resource with create_resources() when it nobody calls that function (in this module).

@nbarrientos
Copy link
Collaborator

Ok by me. Will wait until the patch queue clears out a bit to send something.

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

Successfully merging a pull request may close this issue.

3 participants