HashiCorp Nomad

v0.2.1 published on Tuesday, Dec 7, 2021 by Pulumi

AclPolicy

Manages an ACL policy registered in Nomad.

Example Usage

using System.IO;
using Pulumi;
using Nomad = Pulumi.Nomad;

class MyStack : Stack
{
    public MyStack()
    {
        var dev = new Nomad.AclPolicy("dev", new Nomad.AclPolicyArgs
        {
            Description = "Submit jobs to the dev environment.",
            RulesHcl = File.ReadAllText($"{path.Module}/dev.hcl"),
        });
    }

}
package main

import (
	"fmt"
	"io/ioutil"

	"github.com/pulumi/pulumi-nomad/sdk/go/nomad"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func readFileOrPanic(path string) pulumi.StringPtrInput {
	data, err := ioutil.ReadFile(path)
	if err != nil {
		panic(err.Error())
	}
	return pulumi.String(string(data))
}

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := nomad.NewAclPolicy(ctx, "dev", &nomad.AclPolicyArgs{
			Description: pulumi.String("Submit jobs to the dev environment."),
			RulesHcl:    readFileOrPanic(fmt.Sprintf("%v%v", path.Module, "/dev.hcl")),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_nomad as nomad

dev = nomad.AclPolicy("dev",
    description="Submit jobs to the dev environment.",
    rules_hcl=(lambda path: open(path).read())(f"{path['module']}/dev.hcl"))
import * as pulumi from "@pulumi/pulumi";
import * as nomad from "@pulumi/nomad";
import * from "fs";

const dev = new nomad.AclPolicy("dev", {
    description: "Submit jobs to the dev environment.",
    rulesHcl: fs.readFileSync(`${path.module}/dev.hcl`),
});

Create a AclPolicy Resource

new AclPolicy(name: string, args: AclPolicyArgs, opts?: CustomResourceOptions);
@overload
def AclPolicy(resource_name: str,
              opts: Optional[ResourceOptions] = None,
              description: Optional[str] = None,
              name: Optional[str] = None,
              rules_hcl: 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)
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.

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:

RulesHcl string
(string: <required>) - The contents of the policy to register, as HCL or JSON.
Description string
(string: "") - A description of the policy.
Name string
(string: <required>) - A unique name for the policy.
RulesHcl string
(string: <required>) - The contents of the policy to register, as HCL or JSON.
Description string
(string: "") - A description of the policy.
Name string
(string: <required>) - A unique name for the policy.
rulesHcl string
(string: <required>) - The contents of the policy to register, as HCL or JSON.
description string
(string: "") - A description of the policy.
name string
(string: <required>) - A unique name for the policy.
rules_hcl str
(string: <required>) - The contents of the policy to register, as HCL or JSON.
description str
(string: "") - A description of the policy.
name str
(string: <required>) - A unique name for the policy.

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 str
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,
        description: Optional[str] = None,
        name: Optional[str] = None,
        rules_hcl: 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)
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
(string: "") - A description of the policy.
Name string
(string: <required>) - A unique name for the policy.
RulesHcl string
(string: <required>) - The contents of the policy to register, as HCL or JSON.
Description string
(string: "") - A description of the policy.
Name string
(string: <required>) - A unique name for the policy.
RulesHcl string
(string: <required>) - The contents of the policy to register, as HCL or JSON.
description string
(string: "") - A description of the policy.
name string
(string: <required>) - A unique name for the policy.
rulesHcl string
(string: <required>) - The contents of the policy to register, as HCL or JSON.
description str
(string: "") - A description of the policy.
name str
(string: <required>) - A unique name for the policy.
rules_hcl str
(string: <required>) - The contents of the policy to register, as HCL or JSON.

Package Details

Repository
https://github.com/pulumi/pulumi-nomad
License
Apache-2.0
Notes
This Pulumi package is based on the nomad Terraform Provider.