etcd.KeyPrefix
Explore with Pulumi AI
Resource to manage all the keys contained within a specified prefix.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as etcd from "@pulumi/etcd";
const helloWorld = new etcd.KeyPrefix("helloWorld", {
clearOnDeletion: true,
keys: [
{
key: "hello",
value: "hello",
},
{
key: "world",
value: "world",
},
],
prefix: "/hello_world/",
});
import pulumi
import pulumi_etcd as etcd
hello_world = etcd.KeyPrefix("helloWorld",
clear_on_deletion=True,
keys=[
{
"key": "hello",
"value": "hello",
},
{
"key": "world",
"value": "world",
},
],
prefix="/hello_world/")
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/etcd/etcd"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := etcd.NewKeyPrefix(ctx, "helloWorld", &etcd.KeyPrefixArgs{
ClearOnDeletion: pulumi.Bool(true),
Keys: etcd.KeyPrefixKeyArray{
&etcd.KeyPrefixKeyArgs{
Key: pulumi.String("hello"),
Value: pulumi.String("hello"),
},
&etcd.KeyPrefixKeyArgs{
Key: pulumi.String("world"),
Value: pulumi.String("world"),
},
},
Prefix: pulumi.String("/hello_world/"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Etcd = Pulumi.Etcd;
return await Deployment.RunAsync(() =>
{
var helloWorld = new Etcd.KeyPrefix("helloWorld", new()
{
ClearOnDeletion = true,
Keys = new[]
{
new Etcd.Inputs.KeyPrefixKeyArgs
{
Key = "hello",
Value = "hello",
},
new Etcd.Inputs.KeyPrefixKeyArgs
{
Key = "world",
Value = "world",
},
},
Prefix = "/hello_world/",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.etcd.KeyPrefix;
import com.pulumi.etcd.KeyPrefixArgs;
import com.pulumi.etcd.inputs.KeyPrefixKeyArgs;
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 helloWorld = new KeyPrefix("helloWorld", KeyPrefixArgs.builder()
.clearOnDeletion(true)
.keys(
KeyPrefixKeyArgs.builder()
.key("hello")
.value("hello")
.build(),
KeyPrefixKeyArgs.builder()
.key("world")
.value("world")
.build())
.prefix("/hello_world/")
.build());
}
}
resources:
helloWorld:
type: etcd:KeyPrefix
properties:
clearOnDeletion: true
keys:
- key: hello
value: hello
- key: world
value: world
prefix: /hello_world/
Create KeyPrefix Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new KeyPrefix(name: string, args: KeyPrefixArgs, opts?: CustomResourceOptions);
@overload
def KeyPrefix(resource_name: str,
args: KeyPrefixArgs,
opts: Optional[ResourceOptions] = None)
@overload
def KeyPrefix(resource_name: str,
opts: Optional[ResourceOptions] = None,
keys: Optional[Sequence[KeyPrefixKeyArgs]] = None,
prefix: Optional[str] = None,
clear_on_deletion: Optional[bool] = None,
key_prefix_id: Optional[str] = None)
func NewKeyPrefix(ctx *Context, name string, args KeyPrefixArgs, opts ...ResourceOption) (*KeyPrefix, error)
public KeyPrefix(string name, KeyPrefixArgs args, CustomResourceOptions? opts = null)
public KeyPrefix(String name, KeyPrefixArgs args)
public KeyPrefix(String name, KeyPrefixArgs args, CustomResourceOptions options)
type: etcd:KeyPrefix
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 KeyPrefixArgs
- 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 KeyPrefixArgs
- 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 KeyPrefixArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args KeyPrefixArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args KeyPrefixArgs
- 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 keyPrefixResource = new Etcd.KeyPrefix("keyPrefixResource", new()
{
Keys = new[]
{
new Etcd.Inputs.KeyPrefixKeyArgs
{
Key = "string",
Value = "string",
},
},
Prefix = "string",
ClearOnDeletion = false,
KeyPrefixId = "string",
});
example, err := etcd.NewKeyPrefix(ctx, "keyPrefixResource", &etcd.KeyPrefixArgs{
Keys: etcd.KeyPrefixKeyArray{
&etcd.KeyPrefixKeyArgs{
Key: pulumi.String("string"),
Value: pulumi.String("string"),
},
},
Prefix: pulumi.String("string"),
ClearOnDeletion: pulumi.Bool(false),
KeyPrefixId: pulumi.String("string"),
})
var keyPrefixResource = new KeyPrefix("keyPrefixResource", KeyPrefixArgs.builder()
.keys(KeyPrefixKeyArgs.builder()
.key("string")
.value("string")
.build())
.prefix("string")
.clearOnDeletion(false)
.keyPrefixId("string")
.build());
key_prefix_resource = etcd.KeyPrefix("keyPrefixResource",
keys=[{
"key": "string",
"value": "string",
}],
prefix="string",
clear_on_deletion=False,
key_prefix_id="string")
const keyPrefixResource = new etcd.KeyPrefix("keyPrefixResource", {
keys: [{
key: "string",
value: "string",
}],
prefix: "string",
clearOnDeletion: false,
keyPrefixId: "string",
});
type: etcd:KeyPrefix
properties:
clearOnDeletion: false
keyPrefixId: string
keys:
- key: string
value: string
prefix: string
KeyPrefix Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The KeyPrefix resource accepts the following input properties:
- Keys
List<Key
Prefix Key> - Keys to define in the prefix.
- Prefix string
- Prefix of keys to set.
- Clear
On boolDeletion - Whether to clear all existing keys with the prefix when the resource is deleted.
- Key
Prefix stringId - The ID of this resource.
- Keys
[]Key
Prefix Key Args - Keys to define in the prefix.
- Prefix string
- Prefix of keys to set.
- Clear
On boolDeletion - Whether to clear all existing keys with the prefix when the resource is deleted.
- Key
Prefix stringId - The ID of this resource.
- keys
List<Key
Prefix Key> - Keys to define in the prefix.
- prefix String
- Prefix of keys to set.
- clear
On BooleanDeletion - Whether to clear all existing keys with the prefix when the resource is deleted.
- key
Prefix StringId - The ID of this resource.
- keys
Key
Prefix Key[] - Keys to define in the prefix.
- prefix string
- Prefix of keys to set.
- clear
On booleanDeletion - Whether to clear all existing keys with the prefix when the resource is deleted.
- key
Prefix stringId - The ID of this resource.
- keys
Sequence[Key
Prefix Key Args] - Keys to define in the prefix.
- prefix str
- Prefix of keys to set.
- clear_
on_ booldeletion - Whether to clear all existing keys with the prefix when the resource is deleted.
- key_
prefix_ strid - The ID of this resource.
- keys List<Property Map>
- Keys to define in the prefix.
- prefix String
- Prefix of keys to set.
- clear
On BooleanDeletion - Whether to clear all existing keys with the prefix when the resource is deleted.
- key
Prefix StringId - The ID of this resource.
Outputs
All input properties are implicitly available as output properties. Additionally, the KeyPrefix 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 KeyPrefix Resource
Get an existing KeyPrefix 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?: KeyPrefixState, opts?: CustomResourceOptions): KeyPrefix
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
clear_on_deletion: Optional[bool] = None,
key_prefix_id: Optional[str] = None,
keys: Optional[Sequence[KeyPrefixKeyArgs]] = None,
prefix: Optional[str] = None) -> KeyPrefix
func GetKeyPrefix(ctx *Context, name string, id IDInput, state *KeyPrefixState, opts ...ResourceOption) (*KeyPrefix, error)
public static KeyPrefix Get(string name, Input<string> id, KeyPrefixState? state, CustomResourceOptions? opts = null)
public static KeyPrefix get(String name, Output<String> id, KeyPrefixState state, CustomResourceOptions options)
resources: _: type: etcd:KeyPrefix get: id: ${id}
- 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.
- Clear
On boolDeletion - Whether to clear all existing keys with the prefix when the resource is deleted.
- Key
Prefix stringId - The ID of this resource.
- Keys
List<Key
Prefix Key> - Keys to define in the prefix.
- Prefix string
- Prefix of keys to set.
- Clear
On boolDeletion - Whether to clear all existing keys with the prefix when the resource is deleted.
- Key
Prefix stringId - The ID of this resource.
- Keys
[]Key
Prefix Key Args - Keys to define in the prefix.
- Prefix string
- Prefix of keys to set.
- clear
On BooleanDeletion - Whether to clear all existing keys with the prefix when the resource is deleted.
- key
Prefix StringId - The ID of this resource.
- keys
List<Key
Prefix Key> - Keys to define in the prefix.
- prefix String
- Prefix of keys to set.
- clear
On booleanDeletion - Whether to clear all existing keys with the prefix when the resource is deleted.
- key
Prefix stringId - The ID of this resource.
- keys
Key
Prefix Key[] - Keys to define in the prefix.
- prefix string
- Prefix of keys to set.
- clear_
on_ booldeletion - Whether to clear all existing keys with the prefix when the resource is deleted.
- key_
prefix_ strid - The ID of this resource.
- keys
Sequence[Key
Prefix Key Args] - Keys to define in the prefix.
- prefix str
- Prefix of keys to set.
- clear
On BooleanDeletion - Whether to clear all existing keys with the prefix when the resource is deleted.
- key
Prefix StringId - The ID of this resource.
- keys List<Property Map>
- Keys to define in the prefix.
- prefix String
- Prefix of keys to set.
Supporting Types
KeyPrefixKey, KeyPrefixKeyArgs
Package Details
- Repository
- etcd ferlab-ste-justine/terraform-provider-etcd
- License
- Notes
- This Pulumi package is based on the
etcd
Terraform Provider.