HashiCorp Consul

v3.6.0 published on Tuesday, Apr 12, 2022 by Pulumi

AclRole

Starting with Consul 1.5.0, the consul.AclRole can be used to managed Consul ACL roles.

Example Usage

using Pulumi;
using Consul = Pulumi.Consul;

class MyStack : Stack
{
    public MyStack()
    {
        var read_policy = new Consul.AclPolicy("read-policy", new Consul.AclPolicyArgs
        {
            Datacenters = 
            {
                "dc1",
            },
            Rules = "node \"\" { policy = \"read\" }",
        });
        var read = new Consul.AclRole("read", new Consul.AclRoleArgs
        {
            Description = "bar",
            Policies = 
            {
                read_policy.Id,
            },
            ServiceIdentities = 
            {
                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{
			Datacenters: pulumi.StringArray{
				pulumi.String("dc1"),
			},
			Rules: pulumi.String("node \"\" { policy = \"read\" }"),
		})
		if err != nil {
			return err
		}
		_, err = consul.NewAclRole(ctx, "read", &consul.AclRoleArgs{
			Description: pulumi.String("bar"),
			Policies: pulumi.StringArray{
				read_policy.ID(),
			},
			ServiceIdentities: AclRoleServiceIdentityArray{
				&AclRoleServiceIdentityArgs{
					ServiceName: pulumi.String("foo"),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}

Coming soon!

import pulumi
import pulumi_consul as consul

read_policy = consul.AclPolicy("read-policy",
    datacenters=["dc1"],
    rules="node \"\" { policy = \"read\" }")
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", {
    datacenters: ["dc1"],
    rules: "node \"\" { policy = \"read\" }",
});
const read = new consul.AclRole("read", {
    description: "bar",
    policies: [read_policy.id],
    serviceIdentities: [{
        serviceName: "foo",
    }],
});

Coming soon!

Create a 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)
@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 the ACL role.

Namespace string

The namespace to create the role within.

NodeIdentities List<AclRoleNodeIdentityArgs>

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.

ServiceIdentities List<AclRoleServiceIdentityArgs>

The list of service identities that should be applied to the role.

Description string

A free form human readable description of the role.

Name string

The name of the ACL role.

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.

ServiceIdentities []AclRoleServiceIdentityArgs

The list of service identities that should be applied to the role.

description String

A free form human readable description of the role.

name String

The name of the ACL role.

namespace String

The namespace to create the role within.

nodeIdentities List<AclRoleNodeIdentityArgs>

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.

serviceIdentities List<AclRoleServiceIdentityArgs>

The list of service identities that should be applied to the role.

description string

A free form human readable description of the role.

name string

The name of the ACL role.

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.

serviceIdentities AclRoleServiceIdentityArgs[]

The list of service identities that should be applied to the role.

description str

A free form human readable description of the role.

name str

The name of the ACL role.

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.

service_identities Sequence[AclRoleServiceIdentityArgs]

The list of service identities that should be applied to the role.

description String

A free form human readable description of the role.

name String

The name of the ACL role.

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.

serviceIdentities List<Property Map>

The list of service identities that should be applied to the role.

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 an 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) -> 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 the ACL role.

Namespace string

The namespace to create the role within.

NodeIdentities List<AclRoleNodeIdentityArgs>

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.

ServiceIdentities List<AclRoleServiceIdentityArgs>

The list of service identities that should be applied to the role.

Description string

A free form human readable description of the role.

Name string

The name of the ACL role.

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.

ServiceIdentities []AclRoleServiceIdentityArgs

The list of service identities that should be applied to the role.

description String

A free form human readable description of the role.

name String

The name of the ACL role.

namespace String

The namespace to create the role within.

nodeIdentities List<AclRoleNodeIdentityArgs>

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.

serviceIdentities List<AclRoleServiceIdentityArgs>

The list of service identities that should be applied to the role.

description string

A free form human readable description of the role.

name string

The name of the ACL role.

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.

serviceIdentities AclRoleServiceIdentityArgs[]

The list of service identities that should be applied to the role.

description str

A free form human readable description of the role.

name str

The name of the ACL role.

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.

service_identities Sequence[AclRoleServiceIdentityArgs]

The list of service identities that should be applied to the role.

description String

A free form human readable description of the role.

name String

The name of the ACL role.

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.

serviceIdentities List<Property Map>

The list of service identities that should be applied to the role.

Supporting Types

AclRoleNodeIdentity

Datacenter string

The datacenter of the node.

NodeName string

The name of the node.

Datacenter string

The datacenter of the node.

NodeName string

The name of the node.

datacenter String

The datacenter of the node.

nodeName String

The name of the node.

datacenter string

The datacenter of the node.

nodeName string

The name of the node.

datacenter str

The datacenter of the node.

node_name str

The name of the node.

datacenter String

The datacenter of the node.

nodeName String

The name of the node.

AclRoleServiceIdentity

ServiceName string

The name of the service.

Datacenters List<string>

The datacenters the effective policy is valid within.

ServiceName string

The name of the service.

Datacenters []string

The datacenters the effective policy is valid within.

serviceName String

The name of the service.

datacenters List<String>

The datacenters the effective policy is valid within.

serviceName string

The name of the service.

datacenters string[]

The datacenters the effective policy is valid within.

service_name str

The name of the service.

datacenters Sequence[str]

The datacenters the effective policy is valid within.

serviceName String

The name of the service.

datacenters List<String>

The datacenters the effective policy is valid within.

Import

consul_acl_role can be imported

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

Package Details

Repository
https://github.com/pulumi/pulumi-consul
License
Apache-2.0
Notes

This Pulumi package is based on the consul Terraform Provider.