1. Packages
  2. HashiCorp Consul
  3. API Docs
  4. AclBindingRule
Consul v3.9.0 published on Thursday, Jul 27, 2023 by Pulumi

consul.AclBindingRule

Explore with Pulumi AI

consul logo
Consul v3.9.0 published on Thursday, Jul 27, 2023 by Pulumi

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

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Consul = Pulumi.Consul;
    
    return await Deployment.RunAsync(() => 
    {
        var minikube = new Consul.AclAuthMethod("minikube", new()
        {
            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()
        {
            AuthMethod = minikube.Name,
            BindName = "minikube",
            BindType = "service",
            Description = "foobar",
            Selector = "serviceaccount.namespace==default",
        });
    
    });
    
    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{
    			Config: pulumi.StringMap{
    				"CACert":            pulumi.String("-----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
    	})
    }
    
    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()        
                .config(Map.ofEntries(
                    Map.entry("CACert", """
    -----BEGIN CERTIFICATE-----
    ...-----END CERTIFICATE-----
    
                    """),
                    Map.entry("Host", "https://192.0.2.42:8443"),
                    Map.entry("ServiceAccountJWT", "eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9...")
                ))
                .description("dev minikube cluster")
                .type("kubernetes")
                .build());
    
            var test = new AclBindingRule("test", AclBindingRuleArgs.builder()        
                .authMethod(minikube.name())
                .bindName("minikube")
                .bindType("service")
                .description("foobar")
                .selector("serviceaccount.namespace==default")
                .build());
    
        }
    }
    
    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",
    });
    
    resources:
      minikube:
        type: consul:AclAuthMethod
        properties:
          config:
            CACert: |+
              -----BEGIN CERTIFICATE-----
              ...-----END CERTIFICATE-----          
    
            Host: https://192.0.2.42:8443
            ServiceAccountJWT: eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9...
          description: dev minikube cluster
          type: kubernetes
      test:
        type: consul:AclBindingRule
        properties:
          authMethod: ${minikube.name}
          bindName: minikube
          bindType: service
          description: foobar
          selector: serviceaccount.namespace==default
    

    Create AclBindingRule Resource

    new AclBindingRule(name: string, args: AclBindingRuleArgs, opts?: CustomResourceOptions);
    @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,
                       description: Optional[str] = None,
                       namespace: Optional[str] = None,
                       partition: Optional[str] = None,
                       selector: Optional[str] = None)
    @overload
    def AclBindingRule(resource_name: str,
                       args: AclBindingRuleArgs,
                       opts: Optional[ResourceOptions] = 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.
    
    
    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.

    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.

    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 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.

    Partition string

    The partition the ACL binding rule is associated with.

    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.

    partition String

    The partition the ACL binding rule is associated with.

    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.

    partition string

    The partition the ACL binding rule is associated with.

    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.

    partition str

    The partition the ACL binding rule is associated with.

    selector str

    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.

    partition String

    The partition the ACL binding rule is associated with.

    selector String

    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 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,
            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.

    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 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.

    Partition string

    The partition the ACL binding rule is associated with.

    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.

    partition String

    The partition the ACL binding rule is associated with.

    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.

    partition string

    The partition the ACL binding rule is associated with.

    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.

    partition str

    The partition the ACL binding rule is associated with.

    selector str

    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.

    partition String

    The partition the ACL binding rule is associated with.

    selector String

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

    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.9.0 published on Thursday, Jul 27, 2023 by Pulumi