HashiCorp Consul

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

AclPolicy

Starting with Consul 1.4.0, the consul.AclPolicy can be used to managed Consul ACL policies.

Example Usage

using Pulumi;
using Consul = Pulumi.Consul;

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

",
        });
    }

}
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 {
		_, err := consul.NewAclPolicy(ctx, "test", &consul.AclPolicyArgs{
			Datacenters: pulumi.StringArray{
				pulumi.String("dc1"),
			},
			Rules: pulumi.String(fmt.Sprintf("%v%v%v%v", "node_prefix \"\" {\n", "  policy = \"read\"\n", "}\n", "\n")),
		})
		if err != nil {
			return err
		}
		return nil
	})
}

Coming soon!

import pulumi
import pulumi_consul as consul

test = consul.AclPolicy("test",
    datacenters=["dc1"],
    rules="""node_prefix "" {
  policy = "read"
}

""")
import * as pulumi from "@pulumi/pulumi";
import * as consul from "@pulumi/consul";

const test = new consul.AclPolicy("test", {
    datacenters: ["dc1"],
    rules: `node_prefix "" {
  policy = "read"
}
`,
});

Coming soon!

Create a AclPolicy Resource

new AclPolicy(name: string, args: AclPolicyArgs, opts?: CustomResourceOptions);
@overload
def AclPolicy(resource_name: str,
              opts: Optional[ResourceOptions] = None,
              datacenters: Optional[Sequence[str]] = None,
              description: Optional[str] = None,
              name: Optional[str] = None,
              namespace: Optional[str] = None,
              partition: Optional[str] = None,
              rules: Optional[str] = None)
@overload
def AclPolicy(resource_name: str,
              args: AclPolicyArgs,
              opts: Optional[ResourceOptions] = None)
func NewAclPolicy(ctx *Context, name string, args AclPolicyArgs, opts ...ResourceOption) (*AclPolicy, error)
public AclPolicy(string name, AclPolicyArgs args, CustomResourceOptions? opts = null)
public AclPolicy(String name, AclPolicyArgs args)
public AclPolicy(String name, AclPolicyArgs args, CustomResourceOptions options)
type: consul:AclPolicy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

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

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

Rules string

The rules of the policy.

Datacenters List<string>

The datacenters of the policy.

Description string

The description of the policy.

Name string

The name of the policy.

Namespace string

The namespace to create the policy within.

Partition string

The partition the ACL policy is associated with.

Rules string

The rules of the policy.

Datacenters []string

The datacenters of the policy.

Description string

The description of the policy.

Name string

The name of the policy.

Namespace string

The namespace to create the policy within.

Partition string

The partition the ACL policy is associated with.

rules String

The rules of the policy.

datacenters List<String>

The datacenters of the policy.

description String

The description of the policy.

name String

The name of the policy.

namespace String

The namespace to create the policy within.

partition String

The partition the ACL policy is associated with.

rules string

The rules of the policy.

datacenters string[]

The datacenters of the policy.

description string

The description of the policy.

name string

The name of the policy.

namespace string

The namespace to create the policy within.

partition string

The partition the ACL policy is associated with.

rules str

The rules of the policy.

datacenters Sequence[str]

The datacenters of the policy.

description str

The description of the policy.

name str

The name of the policy.

namespace str

The namespace to create the policy within.

partition str

The partition the ACL policy is associated with.

rules String

The rules of the policy.

datacenters List<String>

The datacenters of the policy.

description String

The description of the policy.

name String

The name of the policy.

namespace String

The namespace to create the policy within.

partition String

The partition the ACL policy is associated with.

Outputs

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

Get an existing AclPolicy 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?: AclPolicyState, opts?: CustomResourceOptions): AclPolicy
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        datacenters: Optional[Sequence[str]] = None,
        description: Optional[str] = None,
        name: Optional[str] = None,
        namespace: Optional[str] = None,
        partition: Optional[str] = None,
        rules: Optional[str] = None) -> AclPolicy
func GetAclPolicy(ctx *Context, name string, id IDInput, state *AclPolicyState, opts ...ResourceOption) (*AclPolicy, error)
public static AclPolicy Get(string name, Input<string> id, AclPolicyState? state, CustomResourceOptions? opts = null)
public static AclPolicy get(String name, Output<String> id, AclPolicyState 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:
Datacenters List<string>

The datacenters of the policy.

Description string

The description of the policy.

Name string

The name of the policy.

Namespace string

The namespace to create the policy within.

Partition string

The partition the ACL policy is associated with.

Rules string

The rules of the policy.

Datacenters []string

The datacenters of the policy.

Description string

The description of the policy.

Name string

The name of the policy.

Namespace string

The namespace to create the policy within.

Partition string

The partition the ACL policy is associated with.

Rules string

The rules of the policy.

datacenters List<String>

The datacenters of the policy.

description String

The description of the policy.

name String

The name of the policy.

namespace String

The namespace to create the policy within.

partition String

The partition the ACL policy is associated with.

rules String

The rules of the policy.

datacenters string[]

The datacenters of the policy.

description string

The description of the policy.

name string

The name of the policy.

namespace string

The namespace to create the policy within.

partition string

The partition the ACL policy is associated with.

rules string

The rules of the policy.

datacenters Sequence[str]

The datacenters of the policy.

description str

The description of the policy.

name str

The name of the policy.

namespace str

The namespace to create the policy within.

partition str

The partition the ACL policy is associated with.

rules str

The rules of the policy.

datacenters List<String>

The datacenters of the policy.

description String

The description of the policy.

name String

The name of the policy.

namespace String

The namespace to create the policy within.

partition String

The partition the ACL policy is associated with.

rules String

The rules of the policy.

Import

consul_acl_policy can be imported

 $ pulumi import consul:index/aclPolicy:AclPolicy my-policy 1c90ef03-a6dd-6a8c-ac49-042ad3752896

Package Details

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

This Pulumi package is based on the consul Terraform Provider.