1. Packages
  2. HashiCorp Consul
  3. API Docs
  4. AclBindingRule
Consul v3.11.3 published on Friday, May 24, 2024 by Pulumi

consul.AclBindingRule

Explore with Pulumi AI

consul logo
Consul v3.11.3 published on Friday, May 24, 2024 by Pulumi

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

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as consul from "@pulumi/consul";
    
    const minikube = new consul.AclAuthMethod("minikube", {
        name: "minikube",
        type: "kubernetes",
        description: "dev minikube cluster",
        config: {
            Host: "https://192.0.2.42:8443",
            CACert: `-----BEGIN CERTIFICATE-----
    ...-----END CERTIFICATE-----
    `,
            ServiceAccountJWT: "eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9...",
        },
    });
    const test = new consul.AclBindingRule("test", {
        authMethod: minikube.name,
        description: "foobar",
        selector: "serviceaccount.namespace==default",
        bindType: "service",
        bindName: "minikube",
    });
    
    import pulumi
    import pulumi_consul as consul
    
    minikube = consul.AclAuthMethod("minikube",
        name="minikube",
        type="kubernetes",
        description="dev minikube cluster",
        config={
            "Host": "https://192.0.2.42:8443",
            "CACert": """-----BEGIN CERTIFICATE-----
    ...-----END CERTIFICATE-----
    """,
            "ServiceAccountJWT": "eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9...",
        })
    test = consul.AclBindingRule("test",
        auth_method=minikube.name,
        description="foobar",
        selector="serviceaccount.namespace==default",
        bind_type="service",
        bind_name="minikube")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-consul/sdk/v3/go/consul"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		minikube, err := consul.NewAclAuthMethod(ctx, "minikube", &consul.AclAuthMethodArgs{
    			Name:        pulumi.String("minikube"),
    			Type:        pulumi.String("kubernetes"),
    			Description: pulumi.String("dev minikube cluster"),
    			Config: pulumi.StringMap{
    				"Host":              pulumi.String("https://192.0.2.42:8443"),
    				"CACert":            pulumi.String("-----BEGIN CERTIFICATE-----\n...-----END CERTIFICATE-----\n"),
    				"ServiceAccountJWT": pulumi.String("eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9..."),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = consul.NewAclBindingRule(ctx, "test", &consul.AclBindingRuleArgs{
    			AuthMethod:  minikube.Name,
    			Description: pulumi.String("foobar"),
    			Selector:    pulumi.String("serviceaccount.namespace==default"),
    			BindType:    pulumi.String("service"),
    			BindName:    pulumi.String("minikube"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Consul = Pulumi.Consul;
    
    return await Deployment.RunAsync(() => 
    {
        var minikube = new Consul.AclAuthMethod("minikube", new()
        {
            Name = "minikube",
            Type = "kubernetes",
            Description = "dev minikube cluster",
            Config = 
            {
                { "Host", "https://192.0.2.42:8443" },
                { "CACert", @"-----BEGIN CERTIFICATE-----
    ...-----END CERTIFICATE-----
    " },
                { "ServiceAccountJWT", "eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9..." },
            },
        });
    
        var test = new Consul.AclBindingRule("test", new()
        {
            AuthMethod = minikube.Name,
            Description = "foobar",
            Selector = "serviceaccount.namespace==default",
            BindType = "service",
            BindName = "minikube",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.consul.AclAuthMethod;
    import com.pulumi.consul.AclAuthMethodArgs;
    import com.pulumi.consul.AclBindingRule;
    import com.pulumi.consul.AclBindingRuleArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var minikube = new AclAuthMethod("minikube", AclAuthMethodArgs.builder()
                .name("minikube")
                .type("kubernetes")
                .description("dev minikube cluster")
                .config(Map.ofEntries(
                    Map.entry("Host", "https://192.0.2.42:8443"),
                    Map.entry("CACert", """
    -----BEGIN CERTIFICATE-----
    ...-----END CERTIFICATE-----
                    """),
                    Map.entry("ServiceAccountJWT", "eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9...")
                ))
                .build());
    
            var test = new AclBindingRule("test", AclBindingRuleArgs.builder()
                .authMethod(minikube.name())
                .description("foobar")
                .selector("serviceaccount.namespace==default")
                .bindType("service")
                .bindName("minikube")
                .build());
    
        }
    }
    
    resources:
      minikube:
        type: consul:AclAuthMethod
        properties:
          name: minikube
          type: kubernetes
          description: dev minikube cluster
          config:
            Host: https://192.0.2.42:8443
            CACert: |
              -----BEGIN CERTIFICATE-----
              ...-----END CERTIFICATE-----          
            ServiceAccountJWT: eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9...
      test:
        type: consul:AclBindingRule
        properties:
          authMethod: ${minikube.name}
          description: foobar
          selector: serviceaccount.namespace==default
          bindType: service
          bindName: minikube
    

    Create AclBindingRule Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new AclBindingRule(name: string, args: AclBindingRuleArgs, opts?: CustomResourceOptions);
    @overload
    def AclBindingRule(resource_name: str,
                       args: AclBindingRuleArgs,
                       opts: Optional[ResourceOptions] = None)
    
    @overload
    def AclBindingRule(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       auth_method: Optional[str] = None,
                       bind_name: Optional[str] = None,
                       bind_type: Optional[str] = None,
                       bind_vars: Optional[AclBindingRuleBindVarsArgs] = None,
                       description: Optional[str] = None,
                       namespace: Optional[str] = None,
                       partition: 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)
    public AclBindingRule(String name, AclBindingRuleArgs args)
    public AclBindingRule(String name, AclBindingRuleArgs args, CustomResourceOptions options)
    
    type: consul:AclBindingRule
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    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.
    args AclBindingRuleArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control 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.
    name String
    The unique name of the resource.
    args AclBindingRuleArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var aclBindingRuleResource = new Consul.AclBindingRule("aclBindingRuleResource", new()
    {
        AuthMethod = "string",
        BindName = "string",
        BindType = "string",
        BindVars = new Consul.Inputs.AclBindingRuleBindVarsArgs
        {
            Name = "string",
        },
        Description = "string",
        Namespace = "string",
        Partition = "string",
        Selector = "string",
    });
    
    example, err := consul.NewAclBindingRule(ctx, "aclBindingRuleResource", &consul.AclBindingRuleArgs{
    	AuthMethod: pulumi.String("string"),
    	BindName:   pulumi.String("string"),
    	BindType:   pulumi.String("string"),
    	BindVars: &consul.AclBindingRuleBindVarsArgs{
    		Name: pulumi.String("string"),
    	},
    	Description: pulumi.String("string"),
    	Namespace:   pulumi.String("string"),
    	Partition:   pulumi.String("string"),
    	Selector:    pulumi.String("string"),
    })
    
    var aclBindingRuleResource = new AclBindingRule("aclBindingRuleResource", AclBindingRuleArgs.builder()
        .authMethod("string")
        .bindName("string")
        .bindType("string")
        .bindVars(AclBindingRuleBindVarsArgs.builder()
            .name("string")
            .build())
        .description("string")
        .namespace("string")
        .partition("string")
        .selector("string")
        .build());
    
    acl_binding_rule_resource = consul.AclBindingRule("aclBindingRuleResource",
        auth_method="string",
        bind_name="string",
        bind_type="string",
        bind_vars=consul.AclBindingRuleBindVarsArgs(
            name="string",
        ),
        description="string",
        namespace="string",
        partition="string",
        selector="string")
    
    const aclBindingRuleResource = new consul.AclBindingRule("aclBindingRuleResource", {
        authMethod: "string",
        bindName: "string",
        bindType: "string",
        bindVars: {
            name: "string",
        },
        description: "string",
        namespace: "string",
        partition: "string",
        selector: "string",
    });
    
    type: consul:AclBindingRule
    properties:
        authMethod: string
        bindName: string
        bindType: string
        bindVars:
            name: string
        description: string
        namespace: string
        partition: string
        selector: string
    

    AclBindingRule Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts 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.
    BindVars AclBindingRuleBindVars
    The variables used when binding rule type is templated-policy. Can be lightly templated using HIL ${foo} syntax from available field names.
    Description string
    A free form human readable description of the binding rule.
    Namespace string
    The namespace to create the binding rule within.
    Partition string
    The partition the ACL binding rule is associated with.
    Selector string
    The expression used to match 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.
    BindVars AclBindingRuleBindVarsArgs
    The variables used when binding rule type is templated-policy. Can be lightly templated using HIL ${foo} syntax from available field names.
    Description string
    A free form human readable description of the binding rule.
    Namespace string
    The namespace to create the binding rule within.
    Partition string
    The partition the ACL binding rule is associated with.
    Selector string
    The expression used to match 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.
    bindVars AclBindingRuleBindVars
    The variables used when binding rule type is templated-policy. Can be lightly templated using HIL ${foo} syntax from available field names.
    description String
    A free form human readable description of the binding rule.
    namespace String
    The namespace to create the binding rule within.
    partition String
    The partition the ACL binding rule is associated with.
    selector String
    The expression used to match 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.
    bindVars AclBindingRuleBindVars
    The variables used when binding rule type is templated-policy. Can be lightly templated using HIL ${foo} syntax from available field names.
    description string
    A free form human readable description of the binding rule.
    namespace string
    The namespace to create the binding rule within.
    partition string
    The partition the ACL binding rule is associated with.
    selector string
    The expression used to match 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.
    bind_vars AclBindingRuleBindVarsArgs
    The variables used when binding rule type is templated-policy. Can be lightly templated using HIL ${foo} syntax from available field names.
    description str
    A free form human readable description of the binding rule.
    namespace str
    The namespace to create the binding rule within.
    partition str
    The partition the ACL binding rule is associated with.
    selector str
    The expression used to match 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.
    bindVars Property Map
    The variables used when binding rule type is templated-policy. Can be lightly templated using HIL ${foo} syntax from available field names.
    description String
    A free form human readable description of the binding rule.
    namespace String
    The namespace to create the binding rule within.
    partition String
    The partition the ACL binding rule is associated with.
    selector String
    The expression used to match 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 string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up 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,
            bind_vars: Optional[AclBindingRuleBindVarsArgs] = None,
            description: Optional[str] = None,
            namespace: Optional[str] = None,
            partition: 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)
    public static AclBindingRule get(String name, Output<String> id, AclBindingRuleState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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.
    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.
    BindVars AclBindingRuleBindVars
    The variables used when binding rule type is templated-policy. Can be lightly templated using HIL ${foo} syntax from available field names.
    Description string
    A free form human readable description of the binding rule.
    Namespace string
    The namespace to create the binding rule within.
    Partition string
    The partition the ACL binding rule is associated with.
    Selector string
    The expression used to match 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.
    BindVars AclBindingRuleBindVarsArgs
    The variables used when binding rule type is templated-policy. Can be lightly templated using HIL ${foo} syntax from available field names.
    Description string
    A free form human readable description of the binding rule.
    Namespace string
    The namespace to create the binding rule within.
    Partition string
    The partition the ACL binding rule is associated with.
    Selector string
    The expression used to match 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.
    bindVars AclBindingRuleBindVars
    The variables used when binding rule type is templated-policy. Can be lightly templated using HIL ${foo} syntax from available field names.
    description String
    A free form human readable description of the binding rule.
    namespace String
    The namespace to create the binding rule within.
    partition String
    The partition the ACL binding rule is associated with.
    selector String
    The expression used to match 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.
    bindVars AclBindingRuleBindVars
    The variables used when binding rule type is templated-policy. Can be lightly templated using HIL ${foo} syntax from available field names.
    description string
    A free form human readable description of the binding rule.
    namespace string
    The namespace to create the binding rule within.
    partition string
    The partition the ACL binding rule is associated with.
    selector string
    The expression used to match 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.
    bind_vars AclBindingRuleBindVarsArgs
    The variables used when binding rule type is templated-policy. Can be lightly templated using HIL ${foo} syntax from available field names.
    description str
    A free form human readable description of the binding rule.
    namespace str
    The namespace to create the binding rule within.
    partition str
    The partition the ACL binding rule is associated with.
    selector str
    The expression used to match 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.
    bindVars Property Map
    The variables used when binding rule type is templated-policy. Can be lightly templated using HIL ${foo} syntax from available field names.
    description String
    A free form human readable description of the binding rule.
    namespace String
    The namespace to create the binding rule within.
    partition String
    The partition the ACL binding rule is associated with.
    selector String
    The expression used to match this rule against valid identities returned from an auth method validation.

    Supporting Types

    AclBindingRuleBindVars, AclBindingRuleBindVarsArgs

    Name string
    The name of node, workload identity or service.
    Name string
    The name of node, workload identity or service.
    name String
    The name of node, workload identity or service.
    name string
    The name of node, workload identity or service.
    name str
    The name of node, workload identity or service.
    name String
    The name of node, workload identity or service.

    Package Details

    Repository
    HashiCorp Consul pulumi/pulumi-consul
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the consul Terraform Provider.
    consul logo
    Consul v3.11.3 published on Friday, May 24, 2024 by Pulumi