1. Packages
  2. HashiCorp Consul
  3. API Docs
  4. AclRole
Consul v3.11.1 published on Friday, Jan 19, 2024 by Pulumi

consul.AclRole

Explore with Pulumi AI

consul logo
Consul v3.11.1 published on Friday, Jan 19, 2024 by Pulumi

    The consul.AclRole can be used to manage Consul ACL roles.

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Consul = Pulumi.Consul;
    
    return await Deployment.RunAsync(() => 
    {
        var read_policy = new Consul.AclPolicy("read-policy", new()
        {
            Rules = "node \"\" { policy = \"read\" }",
            Datacenters = new[]
            {
                "dc1",
            },
        });
    
        var read = new Consul.AclRole("read", new()
        {
            Description = "bar",
            Policies = new[]
            {
                read_policy.Id,
            },
            ServiceIdentities = new[]
            {
                new Consul.Inputs.AclRoleServiceIdentityArgs
                {
                    ServiceName = "foo",
                },
            },
        });
    
    });
    
    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 {
    		_, err := consul.NewAclPolicy(ctx, "read-policy", &consul.AclPolicyArgs{
    			Rules: pulumi.String("node \"\" { policy = \"read\" }"),
    			Datacenters: pulumi.StringArray{
    				pulumi.String("dc1"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = consul.NewAclRole(ctx, "read", &consul.AclRoleArgs{
    			Description: pulumi.String("bar"),
    			Policies: pulumi.StringArray{
    				read_policy.ID(),
    			},
    			ServiceIdentities: consul.AclRoleServiceIdentityArray{
    				&consul.AclRoleServiceIdentityArgs{
    					ServiceName: pulumi.String("foo"),
    				},
    			},
    		})
    		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.AclPolicy;
    import com.pulumi.consul.AclPolicyArgs;
    import com.pulumi.consul.AclRole;
    import com.pulumi.consul.AclRoleArgs;
    import com.pulumi.consul.inputs.AclRoleServiceIdentityArgs;
    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 read_policy = new AclPolicy("read-policy", AclPolicyArgs.builder()        
                .rules("node \"\" { policy = \"read\" }")
                .datacenters("dc1")
                .build());
    
            var read = new AclRole("read", AclRoleArgs.builder()        
                .description("bar")
                .policies(read_policy.id())
                .serviceIdentities(AclRoleServiceIdentityArgs.builder()
                    .serviceName("foo")
                    .build())
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_consul as consul
    
    read_policy = consul.AclPolicy("read-policy",
        rules="node \"\" { policy = \"read\" }",
        datacenters=["dc1"])
    read = consul.AclRole("read",
        description="bar",
        policies=[read_policy.id],
        service_identities=[consul.AclRoleServiceIdentityArgs(
            service_name="foo",
        )])
    
    import * as pulumi from "@pulumi/pulumi";
    import * as consul from "@pulumi/consul";
    
    const read_policy = new consul.AclPolicy("read-policy", {
        rules: "node \"\" { policy = \"read\" }",
        datacenters: ["dc1"],
    });
    const read = new consul.AclRole("read", {
        description: "bar",
        policies: [read_policy.id],
        serviceIdentities: [{
            serviceName: "foo",
        }],
    });
    
    resources:
      read-policy:
        type: consul:AclPolicy
        properties:
          rules: node "" { policy = "read" }
          datacenters:
            - dc1
      read:
        type: consul:AclRole
        properties:
          description: bar
          policies:
            - ${["read-policy"].id}
          serviceIdentities:
            - serviceName: foo
    

    Create AclRole Resource

    new AclRole(name: string, args?: AclRoleArgs, opts?: CustomResourceOptions);
    @overload
    def AclRole(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                description: Optional[str] = None,
                name: Optional[str] = None,
                namespace: Optional[str] = None,
                node_identities: Optional[Sequence[AclRoleNodeIdentityArgs]] = None,
                partition: Optional[str] = None,
                policies: Optional[Sequence[str]] = None,
                service_identities: Optional[Sequence[AclRoleServiceIdentityArgs]] = None,
                templated_policies: Optional[Sequence[AclRoleTemplatedPolicyArgs]] = None)
    @overload
    def AclRole(resource_name: str,
                args: Optional[AclRoleArgs] = None,
                opts: Optional[ResourceOptions] = None)
    func NewAclRole(ctx *Context, name string, args *AclRoleArgs, opts ...ResourceOption) (*AclRole, error)
    public AclRole(string name, AclRoleArgs? args = null, CustomResourceOptions? opts = null)
    public AclRole(String name, AclRoleArgs args)
    public AclRole(String name, AclRoleArgs args, CustomResourceOptions options)
    
    type: consul:AclRole
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args AclRoleArgs
    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 AclRoleArgs
    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 AclRoleArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args AclRoleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args AclRoleArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    AclRole 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 AclRole resource accepts the following input properties:

    Description string
    A free form human readable description of the role.
    Name string
    The name of node, workload identity or service.
    Namespace string
    The namespace to create the role within.
    NodeIdentities List<AclRoleNodeIdentity>
    The list of node identities that should be applied to the role.
    Partition string
    The partition the ACL role is associated with.
    Policies List<string>
    The list of policies that should be applied to the role. Both the policy ID or its name can be used.
    ServiceIdentities List<AclRoleServiceIdentity>
    The list of service identities that should be applied to the role.
    TemplatedPolicies List<AclRoleTemplatedPolicy>
    The list of templated policies that should be applied to the token.
    Description string
    A free form human readable description of the role.
    Name string
    The name of node, workload identity or service.
    Namespace string
    The namespace to create the role within.
    NodeIdentities []AclRoleNodeIdentityArgs
    The list of node identities that should be applied to the role.
    Partition string
    The partition the ACL role is associated with.
    Policies []string
    The list of policies that should be applied to the role. Both the policy ID or its name can be used.
    ServiceIdentities []AclRoleServiceIdentityArgs
    The list of service identities that should be applied to the role.
    TemplatedPolicies []AclRoleTemplatedPolicyArgs
    The list of templated policies that should be applied to the token.
    description String
    A free form human readable description of the role.
    name String
    The name of node, workload identity or service.
    namespace String
    The namespace to create the role within.
    nodeIdentities List<AclRoleNodeIdentity>
    The list of node identities that should be applied to the role.
    partition String
    The partition the ACL role is associated with.
    policies List<String>
    The list of policies that should be applied to the role. Both the policy ID or its name can be used.
    serviceIdentities List<AclRoleServiceIdentity>
    The list of service identities that should be applied to the role.
    templatedPolicies List<AclRoleTemplatedPolicy>
    The list of templated policies that should be applied to the token.
    description string
    A free form human readable description of the role.
    name string
    The name of node, workload identity or service.
    namespace string
    The namespace to create the role within.
    nodeIdentities AclRoleNodeIdentity[]
    The list of node identities that should be applied to the role.
    partition string
    The partition the ACL role is associated with.
    policies string[]
    The list of policies that should be applied to the role. Both the policy ID or its name can be used.
    serviceIdentities AclRoleServiceIdentity[]
    The list of service identities that should be applied to the role.
    templatedPolicies AclRoleTemplatedPolicy[]
    The list of templated policies that should be applied to the token.
    description str
    A free form human readable description of the role.
    name str
    The name of node, workload identity or service.
    namespace str
    The namespace to create the role within.
    node_identities Sequence[AclRoleNodeIdentityArgs]
    The list of node identities that should be applied to the role.
    partition str
    The partition the ACL role is associated with.
    policies Sequence[str]
    The list of policies that should be applied to the role. Both the policy ID or its name can be used.
    service_identities Sequence[AclRoleServiceIdentityArgs]
    The list of service identities that should be applied to the role.
    templated_policies Sequence[AclRoleTemplatedPolicyArgs]
    The list of templated policies that should be applied to the token.
    description String
    A free form human readable description of the role.
    name String
    The name of node, workload identity or service.
    namespace String
    The namespace to create the role within.
    nodeIdentities List<Property Map>
    The list of node identities that should be applied to the role.
    partition String
    The partition the ACL role is associated with.
    policies List<String>
    The list of policies that should be applied to the role. Both the policy ID or its name can be used.
    serviceIdentities List<Property Map>
    The list of service identities that should be applied to the role.
    templatedPolicies List<Property Map>
    The list of templated policies that should be applied to the token.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the AclRole 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 AclRole Resource

    Get an existing AclRole 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?: AclRoleState, opts?: CustomResourceOptions): AclRole
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            description: Optional[str] = None,
            name: Optional[str] = None,
            namespace: Optional[str] = None,
            node_identities: Optional[Sequence[AclRoleNodeIdentityArgs]] = None,
            partition: Optional[str] = None,
            policies: Optional[Sequence[str]] = None,
            service_identities: Optional[Sequence[AclRoleServiceIdentityArgs]] = None,
            templated_policies: Optional[Sequence[AclRoleTemplatedPolicyArgs]] = None) -> AclRole
    func GetAclRole(ctx *Context, name string, id IDInput, state *AclRoleState, opts ...ResourceOption) (*AclRole, error)
    public static AclRole Get(string name, Input<string> id, AclRoleState? state, CustomResourceOptions? opts = null)
    public static AclRole get(String name, Output<String> id, AclRoleState 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:
    Description string
    A free form human readable description of the role.
    Name string
    The name of node, workload identity or service.
    Namespace string
    The namespace to create the role within.
    NodeIdentities List<AclRoleNodeIdentity>
    The list of node identities that should be applied to the role.
    Partition string
    The partition the ACL role is associated with.
    Policies List<string>
    The list of policies that should be applied to the role. Both the policy ID or its name can be used.
    ServiceIdentities List<AclRoleServiceIdentity>
    The list of service identities that should be applied to the role.
    TemplatedPolicies List<AclRoleTemplatedPolicy>
    The list of templated policies that should be applied to the token.
    Description string
    A free form human readable description of the role.
    Name string
    The name of node, workload identity or service.
    Namespace string
    The namespace to create the role within.
    NodeIdentities []AclRoleNodeIdentityArgs
    The list of node identities that should be applied to the role.
    Partition string
    The partition the ACL role is associated with.
    Policies []string
    The list of policies that should be applied to the role. Both the policy ID or its name can be used.
    ServiceIdentities []AclRoleServiceIdentityArgs
    The list of service identities that should be applied to the role.
    TemplatedPolicies []AclRoleTemplatedPolicyArgs
    The list of templated policies that should be applied to the token.
    description String
    A free form human readable description of the role.
    name String
    The name of node, workload identity or service.
    namespace String
    The namespace to create the role within.
    nodeIdentities List<AclRoleNodeIdentity>
    The list of node identities that should be applied to the role.
    partition String
    The partition the ACL role is associated with.
    policies List<String>
    The list of policies that should be applied to the role. Both the policy ID or its name can be used.
    serviceIdentities List<AclRoleServiceIdentity>
    The list of service identities that should be applied to the role.
    templatedPolicies List<AclRoleTemplatedPolicy>
    The list of templated policies that should be applied to the token.
    description string
    A free form human readable description of the role.
    name string
    The name of node, workload identity or service.
    namespace string
    The namespace to create the role within.
    nodeIdentities AclRoleNodeIdentity[]
    The list of node identities that should be applied to the role.
    partition string
    The partition the ACL role is associated with.
    policies string[]
    The list of policies that should be applied to the role. Both the policy ID or its name can be used.
    serviceIdentities AclRoleServiceIdentity[]
    The list of service identities that should be applied to the role.
    templatedPolicies AclRoleTemplatedPolicy[]
    The list of templated policies that should be applied to the token.
    description str
    A free form human readable description of the role.
    name str
    The name of node, workload identity or service.
    namespace str
    The namespace to create the role within.
    node_identities Sequence[AclRoleNodeIdentityArgs]
    The list of node identities that should be applied to the role.
    partition str
    The partition the ACL role is associated with.
    policies Sequence[str]
    The list of policies that should be applied to the role. Both the policy ID or its name can be used.
    service_identities Sequence[AclRoleServiceIdentityArgs]
    The list of service identities that should be applied to the role.
    templated_policies Sequence[AclRoleTemplatedPolicyArgs]
    The list of templated policies that should be applied to the token.
    description String
    A free form human readable description of the role.
    name String
    The name of node, workload identity or service.
    namespace String
    The namespace to create the role within.
    nodeIdentities List<Property Map>
    The list of node identities that should be applied to the role.
    partition String
    The partition the ACL role is associated with.
    policies List<String>
    The list of policies that should be applied to the role. Both the policy ID or its name can be used.
    serviceIdentities List<Property Map>
    The list of service identities that should be applied to the role.
    templatedPolicies List<Property Map>
    The list of templated policies that should be applied to the token.

    Supporting Types

    AclRoleNodeIdentity, AclRoleNodeIdentityArgs

    Datacenter string
    Specifies the node's datacenter.
    NodeName string
    The name of the node.
    Datacenter string
    Specifies the node's datacenter.
    NodeName string
    The name of the node.
    datacenter String
    Specifies the node's datacenter.
    nodeName String
    The name of the node.
    datacenter string
    Specifies the node's datacenter.
    nodeName string
    The name of the node.
    datacenter str
    Specifies the node's datacenter.
    node_name str
    The name of the node.
    datacenter String
    Specifies the node's datacenter.
    nodeName String
    The name of the node.

    AclRoleServiceIdentity, AclRoleServiceIdentityArgs

    ServiceName string
    The name of the service.
    Datacenters List<string>
    The datacenters the effective policy is valid within. When no datacenters are provided the effective policy is valid in all datacenters including those which do not yet exist but may in the future.
    ServiceName string
    The name of the service.
    Datacenters []string
    The datacenters the effective policy is valid within. When no datacenters are provided the effective policy is valid in all datacenters including those which do not yet exist but may in the future.
    serviceName String
    The name of the service.
    datacenters List<String>
    The datacenters the effective policy is valid within. When no datacenters are provided the effective policy is valid in all datacenters including those which do not yet exist but may in the future.
    serviceName string
    The name of the service.
    datacenters string[]
    The datacenters the effective policy is valid within. When no datacenters are provided the effective policy is valid in all datacenters including those which do not yet exist but may in the future.
    service_name str
    The name of the service.
    datacenters Sequence[str]
    The datacenters the effective policy is valid within. When no datacenters are provided the effective policy is valid in all datacenters including those which do not yet exist but may in the future.
    serviceName String
    The name of the service.
    datacenters List<String>
    The datacenters the effective policy is valid within. When no datacenters are provided the effective policy is valid in all datacenters including those which do not yet exist but may in the future.

    AclRoleTemplatedPolicy, AclRoleTemplatedPolicyArgs

    TemplateName string
    The name of the templated policies.
    Datacenters List<string>
    Specifies the datacenters the effective policy is valid within.
    TemplateVariables AclRoleTemplatedPolicyTemplateVariables
    The templated policy variables.
    TemplateName string
    The name of the templated policies.
    Datacenters []string
    Specifies the datacenters the effective policy is valid within.
    TemplateVariables AclRoleTemplatedPolicyTemplateVariables
    The templated policy variables.
    templateName String
    The name of the templated policies.
    datacenters List<String>
    Specifies the datacenters the effective policy is valid within.
    templateVariables AclRoleTemplatedPolicyTemplateVariables
    The templated policy variables.
    templateName string
    The name of the templated policies.
    datacenters string[]
    Specifies the datacenters the effective policy is valid within.
    templateVariables AclRoleTemplatedPolicyTemplateVariables
    The templated policy variables.
    template_name str
    The name of the templated policies.
    datacenters Sequence[str]
    Specifies the datacenters the effective policy is valid within.
    template_variables AclRoleTemplatedPolicyTemplateVariables
    The templated policy variables.
    templateName String
    The name of the templated policies.
    datacenters List<String>
    Specifies the datacenters the effective policy is valid within.
    templateVariables Property Map
    The templated policy variables.

    AclRoleTemplatedPolicyTemplateVariables, AclRoleTemplatedPolicyTemplateVariablesArgs

    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.

    Import

     $ pulumi import consul:index/aclRole:AclRole read 816a195f-6cb1-2e8d-92af-3011ae706318
    

    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.1 published on Friday, Jan 19, 2024 by Pulumi