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: consul.AclRoleServiceIdentityArray{
				&consul.AclRoleServiceIdentityArgs{
					ServiceName: pulumi.String("foo"),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
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",
    }],
});

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

AclRole Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model 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.
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.
Policies []string
The list of policies that should be applied to the role.
ServiceIdentities []AclRoleServiceIdentity
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.
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.
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.

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

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.
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.
Policies []string
The list of policies that should be applied to the role.
ServiceIdentities []AclRoleServiceIdentity
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.
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.
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.

Supporting Types

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

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.