consul.AclRole
Explore with Pulumi AI
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as consul from "@pulumi/consul";
const read_policy = new consul.AclPolicy("read-policy", {
name: "read-policy",
rules: "node \"\" { policy = \"read\" }",
datacenters: ["dc1"],
});
const read = new consul.AclRole("read", {
name: "foo",
description: "bar",
policies: [read_policy.id],
serviceIdentities: [{
serviceName: "foo",
}],
});
import pulumi
import pulumi_consul as consul
read_policy = consul.AclPolicy("read-policy",
name="read-policy",
rules="node \"\" { policy = \"read\" }",
datacenters=["dc1"])
read = consul.AclRole("read",
name="foo",
description="bar",
policies=[read_policy.id],
service_identities=[consul.AclRoleServiceIdentityArgs(
service_name="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{
Name: pulumi.String("read-policy"),
Rules: pulumi.String("node \"\" { policy = \"read\" }"),
Datacenters: pulumi.StringArray{
pulumi.String("dc1"),
},
})
if err != nil {
return err
}
_, err = consul.NewAclRole(ctx, "read", &consul.AclRoleArgs{
Name: pulumi.String("foo"),
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
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Consul = Pulumi.Consul;
return await Deployment.RunAsync(() =>
{
var read_policy = new Consul.AclPolicy("read-policy", new()
{
Name = "read-policy",
Rules = "node \"\" { policy = \"read\" }",
Datacenters = new[]
{
"dc1",
},
});
var read = new Consul.AclRole("read", new()
{
Name = "foo",
Description = "bar",
Policies = new[]
{
read_policy.Id,
},
ServiceIdentities = new[]
{
new Consul.Inputs.AclRoleServiceIdentityArgs
{
ServiceName = "foo",
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.consul.AclPolicy;
import com.pulumi.consul.AclPolicyArgs;
import com.pulumi.consul.AclRole;
import com.pulumi.consul.AclRoleArgs;
import com.pulumi.consul.inputs.AclRoleServiceIdentityArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var read_policy = new AclPolicy("read-policy", AclPolicyArgs.builder()
.name("read-policy")
.rules("node \"\" { policy = \"read\" }")
.datacenters("dc1")
.build());
var read = new AclRole("read", AclRoleArgs.builder()
.name("foo")
.description("bar")
.policies(read_policy.id())
.serviceIdentities(AclRoleServiceIdentityArgs.builder()
.serviceName("foo")
.build())
.build());
}
}
resources:
read-policy:
type: consul:AclPolicy
properties:
name: read-policy
rules: node "" { policy = "read" }
datacenters:
- dc1
read:
type: consul:AclRole
properties:
name: foo
description: bar
policies:
- ${["read-policy"].id}
serviceIdentities:
- serviceName: foo
Create AclRole Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new AclRole(name: string, args?: AclRoleArgs, opts?: CustomResourceOptions);
@overload
def AclRole(resource_name: str,
args: Optional[AclRoleArgs] = None,
opts: Optional[ResourceOptions] = None)
@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,
templated_policies: Optional[Sequence[AclRoleTemplatedPolicyArgs]] = 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.
Parameters
- 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.
Constructor example
The following reference example uses placeholder values for all input properties.
var aclRoleResource = new Consul.AclRole("aclRoleResource", new()
{
Description = "string",
Name = "string",
Namespace = "string",
NodeIdentities = new[]
{
new Consul.Inputs.AclRoleNodeIdentityArgs
{
Datacenter = "string",
NodeName = "string",
},
},
Partition = "string",
Policies = new[]
{
"string",
},
ServiceIdentities = new[]
{
new Consul.Inputs.AclRoleServiceIdentityArgs
{
ServiceName = "string",
Datacenters = new[]
{
"string",
},
},
},
TemplatedPolicies = new[]
{
new Consul.Inputs.AclRoleTemplatedPolicyArgs
{
TemplateName = "string",
Datacenters = new[]
{
"string",
},
TemplateVariables = new Consul.Inputs.AclRoleTemplatedPolicyTemplateVariablesArgs
{
Name = "string",
},
},
},
});
example, err := consul.NewAclRole(ctx, "aclRoleResource", &consul.AclRoleArgs{
Description: pulumi.String("string"),
Name: pulumi.String("string"),
Namespace: pulumi.String("string"),
NodeIdentities: consul.AclRoleNodeIdentityArray{
&consul.AclRoleNodeIdentityArgs{
Datacenter: pulumi.String("string"),
NodeName: pulumi.String("string"),
},
},
Partition: pulumi.String("string"),
Policies: pulumi.StringArray{
pulumi.String("string"),
},
ServiceIdentities: consul.AclRoleServiceIdentityArray{
&consul.AclRoleServiceIdentityArgs{
ServiceName: pulumi.String("string"),
Datacenters: pulumi.StringArray{
pulumi.String("string"),
},
},
},
TemplatedPolicies: consul.AclRoleTemplatedPolicyArray{
&consul.AclRoleTemplatedPolicyArgs{
TemplateName: pulumi.String("string"),
Datacenters: pulumi.StringArray{
pulumi.String("string"),
},
TemplateVariables: &consul.AclRoleTemplatedPolicyTemplateVariablesArgs{
Name: pulumi.String("string"),
},
},
},
})
var aclRoleResource = new AclRole("aclRoleResource", AclRoleArgs.builder()
.description("string")
.name("string")
.namespace("string")
.nodeIdentities(AclRoleNodeIdentityArgs.builder()
.datacenter("string")
.nodeName("string")
.build())
.partition("string")
.policies("string")
.serviceIdentities(AclRoleServiceIdentityArgs.builder()
.serviceName("string")
.datacenters("string")
.build())
.templatedPolicies(AclRoleTemplatedPolicyArgs.builder()
.templateName("string")
.datacenters("string")
.templateVariables(AclRoleTemplatedPolicyTemplateVariablesArgs.builder()
.name("string")
.build())
.build())
.build());
acl_role_resource = consul.AclRole("aclRoleResource",
description="string",
name="string",
namespace="string",
node_identities=[consul.AclRoleNodeIdentityArgs(
datacenter="string",
node_name="string",
)],
partition="string",
policies=["string"],
service_identities=[consul.AclRoleServiceIdentityArgs(
service_name="string",
datacenters=["string"],
)],
templated_policies=[consul.AclRoleTemplatedPolicyArgs(
template_name="string",
datacenters=["string"],
template_variables=consul.AclRoleTemplatedPolicyTemplateVariablesArgs(
name="string",
),
)])
const aclRoleResource = new consul.AclRole("aclRoleResource", {
description: "string",
name: "string",
namespace: "string",
nodeIdentities: [{
datacenter: "string",
nodeName: "string",
}],
partition: "string",
policies: ["string"],
serviceIdentities: [{
serviceName: "string",
datacenters: ["string"],
}],
templatedPolicies: [{
templateName: "string",
datacenters: ["string"],
templateVariables: {
name: "string",
},
}],
});
type: consul:AclRole
properties:
description: string
name: string
namespace: string
nodeIdentities:
- datacenter: string
nodeName: string
partition: string
policies:
- string
serviceIdentities:
- datacenters:
- string
serviceName: string
templatedPolicies:
- datacenters:
- string
templateName: string
templateVariables:
name: string
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.
- Node
Identities List<AclRole Node Identity> - 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. Both the policy ID or its name can be used.
- Service
Identities List<AclRole Service Identity> - The list of service identities that should be applied to the role.
- Templated
Policies List<AclRole Templated Policy> - The list of templated policies that should be applied to the token.
- 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.
- Node
Identities []AclRole Node Identity Args - 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. Both the policy ID or its name can be used.
- Service
Identities []AclRole Service Identity Args - The list of service identities that should be applied to the role.
- Templated
Policies []AclRole Templated Policy Args - The list of templated policies that should be applied to the token.
- 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.
- node
Identities List<AclRole Node Identity> - 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. Both the policy ID or its name can be used.
- service
Identities List<AclRole Service Identity> - The list of service identities that should be applied to the role.
- templated
Policies List<AclRole Templated Policy> - The list of templated policies that should be applied to the token.
- 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.
- node
Identities AclRole Node Identity[] - 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. Both the policy ID or its name can be used.
- service
Identities AclRole Service Identity[] - The list of service identities that should be applied to the role.
- templated
Policies AclRole Templated Policy[] - The list of templated policies that should be applied to the token.
- 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[AclRole Node Identity Args] - 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. Both the policy ID or its name can be used.
- service_
identities Sequence[AclRole Service Identity Args] - The list of service identities that should be applied to the role.
- templated_
policies Sequence[AclRole Templated Policy Args] - The list of templated policies that should be applied to the token.
- 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.
- node
Identities 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. Both the policy ID or its name can be used.
- service
Identities List<Property Map> - The list of service identities that should be applied to the role.
- templated
Policies List<Property Map> - The list of templated policies that should be applied to the token.
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 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,
templated_policies: Optional[Sequence[AclRoleTemplatedPolicyArgs]] = 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.
- 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.
- Node
Identities List<AclRole Node Identity> - 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. Both the policy ID or its name can be used.
- Service
Identities List<AclRole Service Identity> - The list of service identities that should be applied to the role.
- Templated
Policies List<AclRole Templated Policy> - The list of templated policies that should be applied to the token.
- 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.
- Node
Identities []AclRole Node Identity Args - 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. Both the policy ID or its name can be used.
- Service
Identities []AclRole Service Identity Args - The list of service identities that should be applied to the role.
- Templated
Policies []AclRole Templated Policy Args - The list of templated policies that should be applied to the token.
- 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.
- node
Identities List<AclRole Node Identity> - 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. Both the policy ID or its name can be used.
- service
Identities List<AclRole Service Identity> - The list of service identities that should be applied to the role.
- templated
Policies List<AclRole Templated Policy> - The list of templated policies that should be applied to the token.
- 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.
- node
Identities AclRole Node Identity[] - 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. Both the policy ID or its name can be used.
- service
Identities AclRole Service Identity[] - The list of service identities that should be applied to the role.
- templated
Policies AclRole Templated Policy[] - The list of templated policies that should be applied to the token.
- 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[AclRole Node Identity Args] - 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. Both the policy ID or its name can be used.
- service_
identities Sequence[AclRole Service Identity Args] - The list of service identities that should be applied to the role.
- templated_
policies Sequence[AclRole Templated Policy Args] - The list of templated policies that should be applied to the token.
- 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.
- node
Identities 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. Both the policy ID or its name can be used.
- service
Identities List<Property Map> - The list of service identities that should be applied to the role.
- templated
Policies List<Property Map> - The list of templated policies that should be applied to the token.
Supporting Types
AclRoleNodeIdentity, AclRoleNodeIdentityArgs
- Datacenter string
- Specifies the node's datacenter.
- Node
Name string - The name of the node.
- Datacenter string
- Specifies the node's datacenter.
- Node
Name string - The name of the node.
- datacenter String
- Specifies the node's datacenter.
- node
Name String - The name of the node.
- datacenter string
- Specifies the node's datacenter.
- node
Name string - The name of the node.
- datacenter str
- Specifies the node's datacenter.
- node_
name str - The name of the node.
- datacenter String
- Specifies the node's datacenter.
- node
Name String - The name of the node.
AclRoleServiceIdentity, AclRoleServiceIdentityArgs
- Service
Name string - The name of the service.
- Datacenters List<string>
- The datacenters the effective policy is valid within. When no datacenters are provided the effective policy is valid in all datacenters including those which do not yet exist but may in the future.
- Service
Name string - The name of the service.
- Datacenters []string
- The datacenters the effective policy is valid within. When no datacenters are provided the effective policy is valid in all datacenters including those which do not yet exist but may in the future.
- service
Name String - The name of the service.
- datacenters List<String>
- The datacenters the effective policy is valid within. When no datacenters are provided the effective policy is valid in all datacenters including those which do not yet exist but may in the future.
- service
Name string - The name of the service.
- datacenters string[]
- The datacenters the effective policy is valid within. When no datacenters are provided the effective policy is valid in all datacenters including those which do not yet exist but may in the future.
- service_
name str - The name of the service.
- datacenters Sequence[str]
- The datacenters the effective policy is valid within. When no datacenters are provided the effective policy is valid in all datacenters including those which do not yet exist but may in the future.
- service
Name String - The name of the service.
- datacenters List<String>
- The datacenters the effective policy is valid within. When no datacenters are provided the effective policy is valid in all datacenters including those which do not yet exist but may in the future.
AclRoleTemplatedPolicy, AclRoleTemplatedPolicyArgs
- Template
Name string - The name of the templated policies.
- Datacenters List<string>
- Specifies the datacenters the effective policy is valid within.
- Template
Variables AclRole Templated Policy Template Variables - The templated policy variables.
- Template
Name string - The name of the templated policies.
- Datacenters []string
- Specifies the datacenters the effective policy is valid within.
- Template
Variables AclRole Templated Policy Template Variables - The templated policy variables.
- template
Name String - The name of the templated policies.
- datacenters List<String>
- Specifies the datacenters the effective policy is valid within.
- template
Variables AclRole Templated Policy Template Variables - The templated policy variables.
- template
Name string - The name of the templated policies.
- datacenters string[]
- Specifies the datacenters the effective policy is valid within.
- template
Variables AclRole Templated Policy Template Variables - The templated policy variables.
- template_
name str - The name of the templated policies.
- datacenters Sequence[str]
- Specifies the datacenters the effective policy is valid within.
- template_
variables AclRole Templated Policy Template Variables - The templated policy variables.
- template
Name String - The name of the templated policies.
- datacenters List<String>
- Specifies the datacenters the effective policy is valid within.
- template
Variables Property Map - The templated policy variables.
AclRoleTemplatedPolicyTemplateVariables, AclRoleTemplatedPolicyTemplateVariablesArgs
- Name string
- The name of node, workload identity or service.
- Name string
- The name of node, workload identity or service.
- name String
- The name of node, workload identity or service.
- name string
- The name of node, workload identity or service.
- name str
- The name of node, workload identity or service.
- name String
- The name of node, workload identity or service.
Import
$ pulumi import consul:index/aclRole:AclRole read 816a195f-6cb1-2e8d-92af-3011ae706318
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- HashiCorp Consul pulumi/pulumi-consul
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
consul
Terraform Provider.