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 consul_acl type and provider #91

Merged
merged 1 commit into from
Mar 8, 2015

Conversation

michaeltchapman
Copy link
Contributor

This patch adds support for managing consul ACLs.
Rules can be specified in a ruby hash, while type
must be either 'client' or 'management'.

Example:
consul_acl { 'ctoken':
ensure => 'present',
rules => {'key' => {'test' => {'policy' => 'read'}}},
type => 'client',
}

While consul does not enforce unique names, the provider will
not behave consistently if the user manually creates ACLs with the
same name and subsequently attempts to manage them with puppet.

@solarkennedy
Copy link
Contributor

Sweet!

I don't know much about developing types/providers. Does it play well when bootstrapping and the consul server doesn't exist yet?

There are no tests.. so I can't really tell if it works or not, even syntax-wise. I don't know what it takes to test a type/provider. Can you provide a basic test?

@michaeltchapman
Copy link
Contributor Author

The short answer is that during bootstrapping consul won't accept writes, so if you plan on having 3 servers and boot the first one while defining ACLs, the ACL resources will error. This is correct behaviour imo. I probably need to amend the prefetch/instances methods to handle that case more gracefully (right now I think it will throw a confusing error), and I also realised I need to define an autorequire for the consul service.

As far as tests go, writing tests for providers appears to be more complex than writing the provider itself, so...maybe? :)

This patch adds support for managing consul ACLs.
Rules can be specified in a ruby hash, while type
must be either 'client' or 'management'.

Example:
consul_acl { 'ctoken':
  ensure => 'present',
  rules  => {'key' => {'test' => {'policy' => 'read'}}},
  type   => 'client',
}

While consul does not enforce unique names, the provider will
not behave consistently if the user manually creates ACLs with the
same name and subsequently attempts to manage them with puppet.
@michaeltchapman
Copy link
Contributor Author

Add spec tests for custom type.

@solarkennedy
Copy link
Contributor

Nice. Thank you for writing tests. This will give future edits more confidence in this code.

Also thank you for the acl entry point in init.pp to make it easier to deploy with hiera.

Hopefully this will help make everyone's puppet-deployed consul installs able to be more secure!

solarkennedy added a commit that referenced this pull request Mar 8, 2015
Add consul_acl type and provider
@solarkennedy solarkennedy merged commit 07d691f into voxpupuli:master Mar 8, 2015
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 this pull request may close these issues.

2 participants