consul.AclToken

The consul.AclToken resource writes an ACL token into Consul.

Example Usage

Basic usage

using Pulumi;
using Consul = Pulumi.Consul;

class MyStack : Stack
{
    public MyStack()
    {
        var agent = new Consul.AclPolicy("agent", new Consul.AclPolicyArgs
        {
            Rules = @"node_prefix """" {
  policy = ""read""
}

",
        });
        var test = new Consul.AclToken("test", new Consul.AclTokenArgs
        {
            Description = "my test token",
            Local = true,
            Policies = 
            {
                agent.Name,
            },
        });
    }

}
package main

import (
	"fmt"

	"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 {
		agent, err := consul.NewAclPolicy(ctx, "agent", &consul.AclPolicyArgs{
			Rules: pulumi.String(fmt.Sprintf("%v%v%v%v", "node_prefix \"\" {\n", "  policy = \"read\"\n", "}\n", "\n")),
		})
		if err != nil {
			return err
		}
		_, err = consul.NewAclToken(ctx, "test", &consul.AclTokenArgs{
			Description: pulumi.String("my test token"),
			Local:       pulumi.Bool(true),
			Policies: pulumi.StringArray{
				agent.Name,
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}

Coming soon!

import pulumi
import pulumi_consul as consul

agent = consul.AclPolicy("agent", rules="""node_prefix "" {
  policy = "read"
}

""")
test = consul.AclToken("test",
    description="my test token",
    local=True,
    policies=[agent.name])
import * as pulumi from "@pulumi/pulumi";
import * as consul from "@pulumi/consul";

const agent = new consul.AclPolicy("agent", {
    rules: `node_prefix "" {
  policy = "read"
}
`,
});
const test = new consul.AclToken("test", {
    description: "my test token",
    local: true,
    policies: [agent.name],
});

Coming soon!

Create AclToken Resource

new AclToken(name: string, args?: AclTokenArgs, opts?: CustomResourceOptions);
@overload
def AclToken(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             accessor_id: Optional[str] = None,
             description: Optional[str] = None,
             expiration_time: Optional[str] = None,
             local: Optional[bool] = None,
             namespace: Optional[str] = None,
             node_identities: Optional[Sequence[AclTokenNodeIdentityArgs]] = None,
             partition: Optional[str] = None,
             policies: Optional[Sequence[str]] = None,
             roles: Optional[Sequence[str]] = None,
             service_identities: Optional[Sequence[AclTokenServiceIdentityArgs]] = None)
@overload
def AclToken(resource_name: str,
             args: Optional[AclTokenArgs] = None,
             opts: Optional[ResourceOptions] = None)
func NewAclToken(ctx *Context, name string, args *AclTokenArgs, opts ...ResourceOption) (*AclToken, error)
public AclToken(string name, AclTokenArgs? args = null, CustomResourceOptions? opts = null)
public AclToken(String name, AclTokenArgs args)
public AclToken(String name, AclTokenArgs args, CustomResourceOptions options)
type: consul:AclToken
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

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

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

AccessorId string

The uuid of the token. If omitted, Consul will generate a random uuid.

Description string

The description of the token.

ExpirationTime string

If set this represents the point after which a token should be considered revoked and is eligible for destruction.

Local bool

The flag to set the token local to the current datacenter.

Namespace string

The namespace to create the token within.

NodeIdentities List<AclTokenNodeIdentityArgs>

The list of node identities that should be applied to the token.

Partition string

The partition the ACL token is associated with.

Policies List<string>

The list of policies attached to the token.

Roles List<string>

The list of roles attached to the token.

ServiceIdentities List<AclTokenServiceIdentityArgs>

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

AccessorId string

The uuid of the token. If omitted, Consul will generate a random uuid.

Description string

The description of the token.

ExpirationTime string

If set this represents the point after which a token should be considered revoked and is eligible for destruction.

Local bool

The flag to set the token local to the current datacenter.

Namespace string

The namespace to create the token within.

NodeIdentities []AclTokenNodeIdentityArgs

The list of node identities that should be applied to the token.

Partition string

The partition the ACL token is associated with.

Policies []string

The list of policies attached to the token.

Roles []string

The list of roles attached to the token.

ServiceIdentities []AclTokenServiceIdentityArgs

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

accessorId String

The uuid of the token. If omitted, Consul will generate a random uuid.

description String

The description of the token.

expirationTime String

If set this represents the point after which a token should be considered revoked and is eligible for destruction.

local Boolean

The flag to set the token local to the current datacenter.

namespace String

The namespace to create the token within.

nodeIdentities List<AclTokenNodeIdentityArgs>

The list of node identities that should be applied to the token.

partition String

The partition the ACL token is associated with.

policies List<String>

The list of policies attached to the token.

roles List<String>

The list of roles attached to the token.

serviceIdentities List<AclTokenServiceIdentityArgs>

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

accessorId string

The uuid of the token. If omitted, Consul will generate a random uuid.

description string

The description of the token.

expirationTime string

If set this represents the point after which a token should be considered revoked and is eligible for destruction.

local boolean

The flag to set the token local to the current datacenter.

namespace string

The namespace to create the token within.

nodeIdentities AclTokenNodeIdentityArgs[]

The list of node identities that should be applied to the token.

partition string

The partition the ACL token is associated with.

policies string[]

The list of policies attached to the token.

roles string[]

The list of roles attached to the token.

serviceIdentities AclTokenServiceIdentityArgs[]

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

accessor_id str

The uuid of the token. If omitted, Consul will generate a random uuid.

description str

The description of the token.

expiration_time str

If set this represents the point after which a token should be considered revoked and is eligible for destruction.

local bool

The flag to set the token local to the current datacenter.

namespace str

The namespace to create the token within.

node_identities Sequence[AclTokenNodeIdentityArgs]

The list of node identities that should be applied to the token.

partition str

The partition the ACL token is associated with.

policies Sequence[str]

The list of policies attached to the token.

roles Sequence[str]

The list of roles attached to the token.

service_identities Sequence[AclTokenServiceIdentityArgs]

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

accessorId String

The uuid of the token. If omitted, Consul will generate a random uuid.

description String

The description of the token.

expirationTime String

If set this represents the point after which a token should be considered revoked and is eligible for destruction.

local Boolean

The flag to set the token local to the current datacenter.

namespace String

The namespace to create the token within.

nodeIdentities List<Property Map>

The list of node identities that should be applied to the token.

partition String

The partition the ACL token is associated with.

policies List<String>

The list of policies attached to the token.

roles List<String>

The list of roles attached to the token.

serviceIdentities List<Property Map>

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

Outputs

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

Get an existing AclToken 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?: AclTokenState, opts?: CustomResourceOptions): AclToken
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        accessor_id: Optional[str] = None,
        description: Optional[str] = None,
        expiration_time: Optional[str] = None,
        local: Optional[bool] = None,
        namespace: Optional[str] = None,
        node_identities: Optional[Sequence[AclTokenNodeIdentityArgs]] = None,
        partition: Optional[str] = None,
        policies: Optional[Sequence[str]] = None,
        roles: Optional[Sequence[str]] = None,
        service_identities: Optional[Sequence[AclTokenServiceIdentityArgs]] = None) -> AclToken
func GetAclToken(ctx *Context, name string, id IDInput, state *AclTokenState, opts ...ResourceOption) (*AclToken, error)
public static AclToken Get(string name, Input<string> id, AclTokenState? state, CustomResourceOptions? opts = null)
public static AclToken get(String name, Output<String> id, AclTokenState 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:
AccessorId string

The uuid of the token. If omitted, Consul will generate a random uuid.

Description string

The description of the token.

ExpirationTime string

If set this represents the point after which a token should be considered revoked and is eligible for destruction.

Local bool

The flag to set the token local to the current datacenter.

Namespace string

The namespace to create the token within.

NodeIdentities List<AclTokenNodeIdentityArgs>

The list of node identities that should be applied to the token.

Partition string

The partition the ACL token is associated with.

Policies List<string>

The list of policies attached to the token.

Roles List<string>

The list of roles attached to the token.

ServiceIdentities List<AclTokenServiceIdentityArgs>

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

AccessorId string

The uuid of the token. If omitted, Consul will generate a random uuid.

Description string

The description of the token.

ExpirationTime string

If set this represents the point after which a token should be considered revoked and is eligible for destruction.

Local bool

The flag to set the token local to the current datacenter.

Namespace string

The namespace to create the token within.

NodeIdentities []AclTokenNodeIdentityArgs

The list of node identities that should be applied to the token.

Partition string

The partition the ACL token is associated with.

Policies []string

The list of policies attached to the token.

Roles []string

The list of roles attached to the token.

ServiceIdentities []AclTokenServiceIdentityArgs

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

accessorId String

The uuid of the token. If omitted, Consul will generate a random uuid.

description String

The description of the token.

expirationTime String

If set this represents the point after which a token should be considered revoked and is eligible for destruction.

local Boolean

The flag to set the token local to the current datacenter.

namespace String

The namespace to create the token within.

nodeIdentities List<AclTokenNodeIdentityArgs>

The list of node identities that should be applied to the token.

partition String

The partition the ACL token is associated with.

policies List<String>

The list of policies attached to the token.

roles List<String>

The list of roles attached to the token.

serviceIdentities List<AclTokenServiceIdentityArgs>

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

accessorId string

The uuid of the token. If omitted, Consul will generate a random uuid.

description string

The description of the token.

expirationTime string

If set this represents the point after which a token should be considered revoked and is eligible for destruction.

local boolean

The flag to set the token local to the current datacenter.

namespace string

The namespace to create the token within.

nodeIdentities AclTokenNodeIdentityArgs[]

The list of node identities that should be applied to the token.

partition string

The partition the ACL token is associated with.

policies string[]

The list of policies attached to the token.

roles string[]

The list of roles attached to the token.

serviceIdentities AclTokenServiceIdentityArgs[]

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

accessor_id str

The uuid of the token. If omitted, Consul will generate a random uuid.

description str

The description of the token.

expiration_time str

If set this represents the point after which a token should be considered revoked and is eligible for destruction.

local bool

The flag to set the token local to the current datacenter.

namespace str

The namespace to create the token within.

node_identities Sequence[AclTokenNodeIdentityArgs]

The list of node identities that should be applied to the token.

partition str

The partition the ACL token is associated with.

policies Sequence[str]

The list of policies attached to the token.

roles Sequence[str]

The list of roles attached to the token.

service_identities Sequence[AclTokenServiceIdentityArgs]

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

accessorId String

The uuid of the token. If omitted, Consul will generate a random uuid.

description String

The description of the token.

expirationTime String

If set this represents the point after which a token should be considered revoked and is eligible for destruction.

local Boolean

The flag to set the token local to the current datacenter.

namespace String

The namespace to create the token within.

nodeIdentities List<Property Map>

The list of node identities that should be applied to the token.

partition String

The partition the ACL token is associated with.

policies List<String>

The list of policies attached to the token.

roles List<String>

The list of roles attached to the token.

serviceIdentities List<Property Map>

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

Supporting Types

AclTokenNodeIdentity

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.

AclTokenServiceIdentity

ServiceName string

The name of the service.

Datacenters List<string>

The list of datacenters the policy is valid within.

ServiceName string

The name of the service.

Datacenters []string

The list of datacenters the policy is valid within.

serviceName String

The name of the service.

datacenters List<String>

The list of datacenters the policy is valid within.

serviceName string

The name of the service.

datacenters string[]

The list of datacenters the policy is valid within.

service_name str

The name of the service.

datacenters Sequence[str]

The list of datacenters the policy is valid within.

serviceName String

The name of the service.

datacenters List<String>

The list of datacenters the policy is valid within.

Import

consul_acl_token can be imported. This is especially useful to manage the anonymous and the master token with Terraform

 $ pulumi import consul:index/aclToken:AclToken anonymous 00000000-0000-0000-0000-000000000002
 $ pulumi import consul:index/aclToken:AclToken master-token 624d94ca-bc5c-f960-4e83-0a609cf588be

Package Details

Repository
HashiCorp Consul pulumi/pulumi-consul
License
Apache-2.0
Notes

This Pulumi package is based on the consul Terraform Provider.