Consul v3.12.1 published on Friday, Aug 23, 2024 by Pulumi
consul.Keys
Explore with Pulumi AI
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as consul from "@pulumi/consul";
const app = new consul.Keys("app", {
datacenter: "nyc1",
token: "abcd",
keys: [{
path: "service/app/elb_address",
value: appAwsElb.dnsName,
}],
});
import pulumi
import pulumi_consul as consul
app = consul.Keys("app",
datacenter="nyc1",
token="abcd",
keys=[{
"path": "service/app/elb_address",
"value": app_aws_elb["dnsName"],
}])
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.NewKeys(ctx, "app", &consul.KeysArgs{
Datacenter: pulumi.String("nyc1"),
Token: pulumi.String("abcd"),
Keys: consul.KeysKeyArray{
&consul.KeysKeyArgs{
Path: pulumi.String("service/app/elb_address"),
Value: pulumi.Any(appAwsElb.DnsName),
},
},
})
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 app = new Consul.Keys("app", new()
{
Datacenter = "nyc1",
Token = "abcd",
KeysCollection = new[]
{
new Consul.Inputs.KeysKeyArgs
{
Path = "service/app/elb_address",
Value = appAwsElb.DnsName,
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.consul.Keys;
import com.pulumi.consul.KeysArgs;
import com.pulumi.consul.inputs.KeysKeyArgs;
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 app = new Keys("app", KeysArgs.builder()
.datacenter("nyc1")
.token("abcd")
.keys(KeysKeyArgs.builder()
.path("service/app/elb_address")
.value(appAwsElb.dnsName())
.build())
.build());
}
}
resources:
app:
type: consul:Keys
properties:
datacenter: nyc1
token: abcd
keys:
- path: service/app/elb_address
value: ${appAwsElb.dnsName}
Create Keys Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Keys(name: string, args?: KeysArgs, opts?: CustomResourceOptions);
@overload
def Keys(resource_name: str,
args: Optional[KeysArgs] = None,
opts: Optional[ResourceOptions] = None)
@overload
def Keys(resource_name: str,
opts: Optional[ResourceOptions] = None,
datacenter: Optional[str] = None,
keys: Optional[Sequence[KeysKeyArgs]] = None,
namespace: Optional[str] = None,
partition: Optional[str] = None,
token: Optional[str] = None)
func NewKeys(ctx *Context, name string, args *KeysArgs, opts ...ResourceOption) (*Keys, error)
public Keys(string name, KeysArgs? args = null, CustomResourceOptions? opts = null)
type: consul:Keys
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 KeysArgs
- 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 KeysArgs
- 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 KeysArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args KeysArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args KeysArgs
- 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 keysResource = new Consul.Keys("keysResource", new()
{
Datacenter = "string",
KeysCollection = new[]
{
new Consul.Inputs.KeysKeyArgs
{
Path = "string",
Default = "string",
Delete = false,
Flags = 0,
Value = "string",
},
},
Namespace = "string",
Partition = "string",
});
example, err := consul.NewKeys(ctx, "keysResource", &consul.KeysArgs{
Datacenter: pulumi.String("string"),
Keys: consul.KeysKeyArray{
&consul.KeysKeyArgs{
Path: pulumi.String("string"),
Default: pulumi.String("string"),
Delete: pulumi.Bool(false),
Flags: pulumi.Int(0),
Value: pulumi.String("string"),
},
},
Namespace: pulumi.String("string"),
Partition: pulumi.String("string"),
})
var keysResource = new Keys("keysResource", KeysArgs.builder()
.datacenter("string")
.keys(KeysKeyArgs.builder()
.path("string")
.default_("string")
.delete(false)
.flags(0)
.value("string")
.build())
.namespace("string")
.partition("string")
.build());
keys_resource = consul.Keys("keysResource",
datacenter="string",
keys=[consul.KeysKeyArgs(
path="string",
default="string",
delete=False,
flags=0,
value="string",
)],
namespace="string",
partition="string")
const keysResource = new consul.Keys("keysResource", {
datacenter: "string",
keys: [{
path: "string",
"default": "string",
"delete": false,
flags: 0,
value: "string",
}],
namespace: "string",
partition: "string",
});
type: consul:Keys
properties:
datacenter: string
keys:
- default: string
delete: false
flags: 0
path: string
value: string
namespace: string
partition: string
Keys 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 Keys resource accepts the following input properties:
- Datacenter string
- The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
- Keys
Collection List<KeysKey> - Specifies a key in Consul to be written. Supported values documented below.
- Namespace string
- The namespace to create the keys within.
- Partition string
- The partition to create the keys within.
- Token string
- The ACL token to use. This overrides the token that the agent provides by default.
- Datacenter string
- The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
- Keys
[]Keys
Key Args - Specifies a key in Consul to be written. Supported values documented below.
- Namespace string
- The namespace to create the keys within.
- Partition string
- The partition to create the keys within.
- Token string
- The ACL token to use. This overrides the token that the agent provides by default.
- datacenter String
- The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
- keys
List<Keys
Key> - Specifies a key in Consul to be written. Supported values documented below.
- namespace String
- The namespace to create the keys within.
- partition String
- The partition to create the keys within.
- token String
- The ACL token to use. This overrides the token that the agent provides by default.
- datacenter string
- The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
- keys
Keys
Key[] - Specifies a key in Consul to be written. Supported values documented below.
- namespace string
- The namespace to create the keys within.
- partition string
- The partition to create the keys within.
- token string
- The ACL token to use. This overrides the token that the agent provides by default.
- datacenter str
- The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
- keys
Sequence[Keys
Key Args] - Specifies a key in Consul to be written. Supported values documented below.
- namespace str
- The namespace to create the keys within.
- partition str
- The partition to create the keys within.
- token str
- The ACL token to use. This overrides the token that the agent provides by default.
- datacenter String
- The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
- keys List<Property Map>
- Specifies a key in Consul to be written. Supported values documented below.
- namespace String
- The namespace to create the keys within.
- partition String
- The partition to create the keys within.
- token String
- The ACL token to use. This overrides the token that the agent provides by default.
Outputs
All input properties are implicitly available as output properties. Additionally, the Keys resource produces the following output properties:
Look up Existing Keys Resource
Get an existing Keys 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?: KeysState, opts?: CustomResourceOptions): Keys
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
datacenter: Optional[str] = None,
keys: Optional[Sequence[KeysKeyArgs]] = None,
namespace: Optional[str] = None,
partition: Optional[str] = None,
token: Optional[str] = None,
var: Optional[Mapping[str, str]] = None) -> Keys
func GetKeys(ctx *Context, name string, id IDInput, state *KeysState, opts ...ResourceOption) (*Keys, error)
public static Keys Get(string name, Input<string> id, KeysState? state, CustomResourceOptions? opts = null)
public static Keys get(String name, Output<String> id, KeysState 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.
- Datacenter string
- The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
- Keys
Collection List<KeysKey> - Specifies a key in Consul to be written. Supported values documented below.
- Namespace string
- The namespace to create the keys within.
- Partition string
- The partition to create the keys within.
- Token string
- The ACL token to use. This overrides the token that the agent provides by default.
- Var Dictionary<string, string>
- Datacenter string
- The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
- Keys
[]Keys
Key Args - Specifies a key in Consul to be written. Supported values documented below.
- Namespace string
- The namespace to create the keys within.
- Partition string
- The partition to create the keys within.
- Token string
- The ACL token to use. This overrides the token that the agent provides by default.
- Var map[string]string
- datacenter String
- The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
- keys
List<Keys
Key> - Specifies a key in Consul to be written. Supported values documented below.
- namespace String
- The namespace to create the keys within.
- partition String
- The partition to create the keys within.
- token String
- The ACL token to use. This overrides the token that the agent provides by default.
- var_ Map<String,String>
- datacenter string
- The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
- keys
Keys
Key[] - Specifies a key in Consul to be written. Supported values documented below.
- namespace string
- The namespace to create the keys within.
- partition string
- The partition to create the keys within.
- token string
- The ACL token to use. This overrides the token that the agent provides by default.
- var {[key: string]: string}
- datacenter str
- The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
- keys
Sequence[Keys
Key Args] - Specifies a key in Consul to be written. Supported values documented below.
- namespace str
- The namespace to create the keys within.
- partition str
- The partition to create the keys within.
- token str
- The ACL token to use. This overrides the token that the agent provides by default.
- var Mapping[str, str]
- datacenter String
- The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
- keys List<Property Map>
- Specifies a key in Consul to be written. Supported values documented below.
- namespace String
- The namespace to create the keys within.
- partition String
- The partition to create the keys within.
- token String
- The ACL token to use. This overrides the token that the agent provides by default.
- var Map<String>
Supporting Types
KeysKey, KeysKeyArgs
- Path string
- This is the path in Consul that should be written to.
- Default string
- Delete bool
- If true, then the key will be deleted when either its configuration block is removed from the configuration or the entire resource is destroyed. Otherwise, it will be left in Consul. Defaults to false.
- Flags int
- An unsigned integer value to attach to the key (defaults to 0).
- Name string
- Value string
- The value to write to the given path.
- Path string
- This is the path in Consul that should be written to.
- Default string
- Delete bool
- If true, then the key will be deleted when either its configuration block is removed from the configuration or the entire resource is destroyed. Otherwise, it will be left in Consul. Defaults to false.
- Flags int
- An unsigned integer value to attach to the key (defaults to 0).
- Name string
- Value string
- The value to write to the given path.
- path String
- This is the path in Consul that should be written to.
- default_ String
- delete Boolean
- If true, then the key will be deleted when either its configuration block is removed from the configuration or the entire resource is destroyed. Otherwise, it will be left in Consul. Defaults to false.
- flags Integer
- An unsigned integer value to attach to the key (defaults to 0).
- name String
- value String
- The value to write to the given path.
- path string
- This is the path in Consul that should be written to.
- default string
- delete boolean
- If true, then the key will be deleted when either its configuration block is removed from the configuration or the entire resource is destroyed. Otherwise, it will be left in Consul. Defaults to false.
- flags number
- An unsigned integer value to attach to the key (defaults to 0).
- name string
- value string
- The value to write to the given path.
- path str
- This is the path in Consul that should be written to.
- default str
- delete bool
- If true, then the key will be deleted when either its configuration block is removed from the configuration or the entire resource is destroyed. Otherwise, it will be left in Consul. Defaults to false.
- flags int
- An unsigned integer value to attach to the key (defaults to 0).
- name str
- value str
- The value to write to the given path.
- path String
- This is the path in Consul that should be written to.
- default String
- delete Boolean
- If true, then the key will be deleted when either its configuration block is removed from the configuration or the entire resource is destroyed. Otherwise, it will be left in Consul. Defaults to false.
- flags Number
- An unsigned integer value to attach to the key (defaults to 0).
- name String
- value String
- The value to write to the given path.
Package Details
- Repository
- HashiCorp Consul pulumi/pulumi-consul
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
consul
Terraform Provider.