Ready to level-up your engineering skills? Join a Pulumi Workshop. Register Now

AclBindingRule

Starting with Consul 1.5.0, the consul.AclBindingRule resource can be used to managed Consul ACL binding rules.

Example Usage

using Pulumi;
using Consul = Pulumi.Consul;

class MyStack : Stack
{
    public MyStack()
    {
        var minikube = new Consul.AclAuthMethod("minikube", new Consul.AclAuthMethodArgs
        {
            Config = 
            {
                { "CACert", @"-----BEGIN CERTIFICATE-----
...-----END CERTIFICATE-----

" },
                { "Host", "https://192.0.2.42:8443" },
                { "ServiceAccountJWT", "eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9..." },
            },
            Description = "dev minikube cluster",
            Type = "kubernetes",
        });
        var test = new Consul.AclBindingRule("test", new Consul.AclBindingRuleArgs
        {
            AuthMethod = minikube.Name,
            BindName = "minikube",
            BindType = "service",
            Description = "foobar",
            Selector = "serviceaccount.namespace==default",
        });
    }

}
package main

import (
    "fmt"

    "github.com/pulumi/pulumi-consul/sdk/v2/go/consul"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        minikube, err := consul.NewAclAuthMethod(ctx, "minikube", &consul.AclAuthMethodArgs{
            Config: pulumi.StringMap{
                "CACert":            pulumi.String(fmt.Sprintf("%v%v%v", "-----BEGIN CERTIFICATE-----\n", "...-----END CERTIFICATE-----\n", "\n")),
                "Host":              pulumi.String("https://192.0.2.42:8443"),
                "ServiceAccountJWT": pulumi.String("eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9..."),
            },
            Description: pulumi.String("dev minikube cluster"),
            Type:        pulumi.String("kubernetes"),
        })
        if err != nil {
            return err
        }
        _, err = consul.NewAclBindingRule(ctx, "test", &consul.AclBindingRuleArgs{
            AuthMethod:  minikube.Name,
            BindName:    pulumi.String("minikube"),
            BindType:    pulumi.String("service"),
            Description: pulumi.String("foobar"),
            Selector:    pulumi.String("serviceaccount.namespace==default"),
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_consul as consul

minikube = consul.AclAuthMethod("minikube",
    config={
        "CACert": """-----BEGIN CERTIFICATE-----
...-----END CERTIFICATE-----

""",
        "Host": "https://192.0.2.42:8443",
        "ServiceAccountJWT": "eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9...",
    },
    description="dev minikube cluster",
    type="kubernetes")
test = consul.AclBindingRule("test",
    auth_method=minikube.name,
    bind_name="minikube",
    bind_type="service",
    description="foobar",
    selector="serviceaccount.namespace==default")
import * as pulumi from "@pulumi/pulumi";
import * as consul from "@pulumi/consul";

const minikube = new consul.AclAuthMethod("minikube", {
    config: {
        CACert: `-----BEGIN CERTIFICATE-----
...-----END CERTIFICATE-----
`,
        Host: "https://192.0.2.42:8443",
        ServiceAccountJWT: "eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9...",
    },
    description: "dev minikube cluster",
    type: "kubernetes",
});
const test = new consul.AclBindingRule("test", {
    authMethod: minikube.name,
    bindName: "minikube",
    bindType: "service",
    description: "foobar",
    selector: "serviceaccount.namespace==default",
});

Create a AclBindingRule Resource

new AclBindingRule(name: string, args: AclBindingRuleArgs, opts?: CustomResourceOptions);
def AclBindingRule(resource_name: str, opts: Optional[ResourceOptions] = None, auth_method: Optional[str] = None, bind_name: Optional[str] = None, bind_type: Optional[str] = None, description: Optional[str] = None, namespace: Optional[str] = None, selector: Optional[str] = None)
func NewAclBindingRule(ctx *Context, name string, args AclBindingRuleArgs, opts ...ResourceOption) (*AclBindingRule, error)
public AclBindingRule(string name, AclBindingRuleArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args AclBindingRuleArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args AclBindingRuleArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args AclBindingRuleArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

AclBindingRule Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The AclBindingRule resource accepts the following input properties:

AuthMethod string

The name of the ACL auth method this rule apply.

BindName string

The name to bind to a token at login-time.

BindType string

Specifies the way the binding rule affects a token created at login.

Description string

A free form human readable description of the binding rule.

Namespace string

The namespace to create the binding rule within.

Selector string

The expression used to math this rule against valid identities returned from an auth method validation.

AuthMethod string

The name of the ACL auth method this rule apply.

BindName string

The name to bind to a token at login-time.

BindType string

Specifies the way the binding rule affects a token created at login.

Description string

A free form human readable description of the binding rule.

Namespace string

The namespace to create the binding rule within.

Selector string

The expression used to math this rule against valid identities returned from an auth method validation.

authMethod string

The name of the ACL auth method this rule apply.

bindName string

The name to bind to a token at login-time.

bindType string

Specifies the way the binding rule affects a token created at login.

description string

A free form human readable description of the binding rule.

namespace string

The namespace to create the binding rule within.

selector string

The expression used to math this rule against valid identities returned from an auth method validation.

auth_method str

The name of the ACL auth method this rule apply.

bind_name str

The name to bind to a token at login-time.

bind_type str

Specifies the way the binding rule affects a token created at login.

description str

A free form human readable description of the binding rule.

namespace str

The namespace to create the binding rule within.

selector str

The expression used to math this rule against valid identities returned from an auth method validation.

Outputs

All input properties are implicitly available as output properties. Additionally, the AclBindingRule resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.

Look up an Existing AclBindingRule Resource

Get an existing AclBindingRule resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: AclBindingRuleState, opts?: CustomResourceOptions): AclBindingRule
@staticmethod
def get(resource_name: str, id: str, opts: Optional[ResourceOptions] = None, auth_method: Optional[str] = None, bind_name: Optional[str] = None, bind_type: Optional[str] = None, description: Optional[str] = None, namespace: Optional[str] = None, selector: Optional[str] = None) -> AclBindingRule
func GetAclBindingRule(ctx *Context, name string, id IDInput, state *AclBindingRuleState, opts ...ResourceOption) (*AclBindingRule, error)
public static AclBindingRule Get(string name, Input<string> id, AclBindingRuleState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

AuthMethod string

The name of the ACL auth method this rule apply.

BindName string

The name to bind to a token at login-time.

BindType string

Specifies the way the binding rule affects a token created at login.

Description string

A free form human readable description of the binding rule.

Namespace string

The namespace to create the binding rule within.

Selector string

The expression used to math this rule against valid identities returned from an auth method validation.

AuthMethod string

The name of the ACL auth method this rule apply.

BindName string

The name to bind to a token at login-time.

BindType string

Specifies the way the binding rule affects a token created at login.

Description string

A free form human readable description of the binding rule.

Namespace string

The namespace to create the binding rule within.

Selector string

The expression used to math this rule against valid identities returned from an auth method validation.

authMethod string

The name of the ACL auth method this rule apply.

bindName string

The name to bind to a token at login-time.

bindType string

Specifies the way the binding rule affects a token created at login.

description string

A free form human readable description of the binding rule.

namespace string

The namespace to create the binding rule within.

selector string

The expression used to math this rule against valid identities returned from an auth method validation.

auth_method str

The name of the ACL auth method this rule apply.

bind_name str

The name to bind to a token at login-time.

bind_type str

Specifies the way the binding rule affects a token created at login.

description str

A free form human readable description of the binding rule.

namespace str

The namespace to create the binding rule within.

selector str

The expression used to math this rule against valid identities returned from an auth method validation.

Package Details

Repository
https://github.com/pulumi/pulumi-consul
License
Apache-2.0
Notes
This Pulumi package is based on the consul Terraform Provider.