2019-05-01 21:11:23 +00:00
|
|
|
---
|
2020-09-01 15:14:13 +00:00
|
|
|
layout: commands
|
2020-04-07 18:55:19 +00:00
|
|
|
page_title: 'Commands: ACL Binding Rule Create'
|
2019-05-01 21:11:23 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
# Consul ACL Binding Rule Create
|
|
|
|
|
|
|
|
Command: `consul acl binding-rule create`
|
|
|
|
|
|
|
|
The `acl binding-rule create` command creates new binding rules.
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
Usage: `consul acl binding-rule create [options] [args]`
|
|
|
|
|
|
|
|
#### API Options
|
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
@include 'http_api_options_client.mdx'
|
2020-04-07 23:56:08 +00:00
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
@include 'http_api_options_server.mdx'
|
2019-05-01 21:11:23 +00:00
|
|
|
|
|
|
|
#### Command Options
|
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
- `-bind-name=<string>` - Name to bind on match. Can use `${var}`
|
2019-05-01 21:11:23 +00:00
|
|
|
interpolation. This flag is required.
|
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
- `-bind-type=<string>` - Type of binding to perform (`"service"` or `"role"`).
|
2019-05-01 21:11:23 +00:00
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
- `-description=<string>` - A description of the binding rule.
|
2019-05-01 21:11:23 +00:00
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
- `-meta` - Indicates that binding rule metadata such as the raft
|
|
|
|
indices should be shown for each entry.
|
2019-05-01 21:11:23 +00:00
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
- `-method=<string>` - The auth method's name for which this binding rule
|
2019-05-01 21:11:23 +00:00
|
|
|
applies. This flag is required.
|
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
- `-selector=<string>` - Selector is an expression that matches against
|
2019-05-01 21:11:23 +00:00
|
|
|
verified identity attributes returned from the auth method during login.
|
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
- `-format={pretty|json}` - Command output format. The default value is `pretty`.
|
2020-03-26 16:03:22 +00:00
|
|
|
|
2019-12-06 16:14:56 +00:00
|
|
|
#### Enterprise Options
|
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
@include 'http_api_namespace_options.mdx'
|
2019-12-06 16:14:56 +00:00
|
|
|
|
2019-05-01 21:11:23 +00:00
|
|
|
## Examples
|
|
|
|
|
|
|
|
Create a new binding rule that binds to a service identity:
|
|
|
|
|
2020-05-19 18:32:38 +00:00
|
|
|
```shell-session
|
2019-05-01 21:11:23 +00:00
|
|
|
$ consul acl binding-rule create -method 'minikube' \
|
|
|
|
-description 'wildcard service' \
|
|
|
|
-bind-type 'service' \
|
|
|
|
-bind-name 'k8s-${serviceaccount.name}' \
|
|
|
|
-selector 'serviceaccount.namespace==default and serviceaccount.name!=vault'
|
|
|
|
ID: 0ec1bd2f-1d3b-bafb-d9bf-90ef04ab1890
|
|
|
|
AuthMethod: minikube
|
|
|
|
Description: wildcard service
|
|
|
|
BindType: service
|
|
|
|
BindName: k8s-${serviceaccount.name}
|
|
|
|
Selector: serviceaccount.namespace==default and serviceaccount.name!=vault
|
|
|
|
```
|
|
|
|
|
|
|
|
Create a new binding rule that binds to a role:
|
|
|
|
|
2020-05-19 18:32:38 +00:00
|
|
|
```shell-session
|
2019-05-01 21:11:23 +00:00
|
|
|
$ consul acl binding-rule create -method 'minikube' \
|
|
|
|
-description 'just vault role' \
|
|
|
|
-bind-type 'role' \
|
|
|
|
-bind-name 'vault' \
|
|
|
|
-selector 'serviceaccount.namespace==default and serviceaccount.name==vault'
|
|
|
|
ID: e21ae868-7b13-a230-0235-f8e83510642c
|
|
|
|
AuthMethod: minikube
|
|
|
|
Description: just vault role
|
|
|
|
BindType: role
|
|
|
|
BindName: vault
|
|
|
|
Selector: serviceaccount.namespace==default and serviceaccount.name==vault
|
|
|
|
```
|