Provides a Datadog Datastore Item resource. This can be used to create and manage items in a Datadog datastore.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as datadog from "@pulumi/datadog";
// Create a datastore and add items to it
const example = new datadog.Datastore("example", {
name: "users-datastore",
description: "Datastore for user data",
primaryColumnName: "id",
primaryKeyGenerationStrategy: "none",
});
// Create a datastore item with the primary key specified in the value map
const user1 = new datadog.DatastoreItem("user1", {
datastoreId: example.id,
itemKey: "user-123",
value: {
id: "user-123",
username: "john_doe",
email: "john@example.com",
status: "active",
},
});
// Create another datastore item
const user2 = new datadog.DatastoreItem("user2", {
datastoreId: example.id,
itemKey: "user-456",
value: {
id: "user-456",
username: "jane_doe",
email: "jane@example.com",
status: "active",
},
});
import pulumi
import pulumi_datadog as datadog
# Create a datastore and add items to it
example = datadog.Datastore("example",
name="users-datastore",
description="Datastore for user data",
primary_column_name="id",
primary_key_generation_strategy="none")
# Create a datastore item with the primary key specified in the value map
user1 = datadog.DatastoreItem("user1",
datastore_id=example.id,
item_key="user-123",
value={
"id": "user-123",
"username": "john_doe",
"email": "john@example.com",
"status": "active",
})
# Create another datastore item
user2 = datadog.DatastoreItem("user2",
datastore_id=example.id,
item_key="user-456",
value={
"id": "user-456",
"username": "jane_doe",
"email": "jane@example.com",
"status": "active",
})
package main
import (
"github.com/pulumi/pulumi-datadog/sdk/v4/go/datadog"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
// Create a datastore and add items to it
example, err := datadog.NewDatastore(ctx, "example", &datadog.DatastoreArgs{
Name: pulumi.String("users-datastore"),
Description: pulumi.String("Datastore for user data"),
PrimaryColumnName: pulumi.String("id"),
PrimaryKeyGenerationStrategy: pulumi.String("none"),
})
if err != nil {
return err
}
// Create a datastore item with the primary key specified in the value map
_, err = datadog.NewDatastoreItem(ctx, "user1", &datadog.DatastoreItemArgs{
DatastoreId: example.ID(),
ItemKey: pulumi.String("user-123"),
Value: pulumi.StringMap{
"id": pulumi.String("user-123"),
"username": pulumi.String("john_doe"),
"email": pulumi.String("john@example.com"),
"status": pulumi.String("active"),
},
})
if err != nil {
return err
}
// Create another datastore item
_, err = datadog.NewDatastoreItem(ctx, "user2", &datadog.DatastoreItemArgs{
DatastoreId: example.ID(),
ItemKey: pulumi.String("user-456"),
Value: pulumi.StringMap{
"id": pulumi.String("user-456"),
"username": pulumi.String("jane_doe"),
"email": pulumi.String("jane@example.com"),
"status": pulumi.String("active"),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Datadog = Pulumi.Datadog;
return await Deployment.RunAsync(() =>
{
// Create a datastore and add items to it
var example = new Datadog.Datastore("example", new()
{
Name = "users-datastore",
Description = "Datastore for user data",
PrimaryColumnName = "id",
PrimaryKeyGenerationStrategy = "none",
});
// Create a datastore item with the primary key specified in the value map
var user1 = new Datadog.DatastoreItem("user1", new()
{
DatastoreId = example.Id,
ItemKey = "user-123",
Value =
{
{ "id", "user-123" },
{ "username", "john_doe" },
{ "email", "john@example.com" },
{ "status", "active" },
},
});
// Create another datastore item
var user2 = new Datadog.DatastoreItem("user2", new()
{
DatastoreId = example.Id,
ItemKey = "user-456",
Value =
{
{ "id", "user-456" },
{ "username", "jane_doe" },
{ "email", "jane@example.com" },
{ "status", "active" },
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.datadog.Datastore;
import com.pulumi.datadog.DatastoreArgs;
import com.pulumi.datadog.DatastoreItem;
import com.pulumi.datadog.DatastoreItemArgs;
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) {
// Create a datastore and add items to it
var example = new Datastore("example", DatastoreArgs.builder()
.name("users-datastore")
.description("Datastore for user data")
.primaryColumnName("id")
.primaryKeyGenerationStrategy("none")
.build());
// Create a datastore item with the primary key specified in the value map
var user1 = new DatastoreItem("user1", DatastoreItemArgs.builder()
.datastoreId(example.id())
.itemKey("user-123")
.value(Map.ofEntries(
Map.entry("id", "user-123"),
Map.entry("username", "john_doe"),
Map.entry("email", "john@example.com"),
Map.entry("status", "active")
))
.build());
// Create another datastore item
var user2 = new DatastoreItem("user2", DatastoreItemArgs.builder()
.datastoreId(example.id())
.itemKey("user-456")
.value(Map.ofEntries(
Map.entry("id", "user-456"),
Map.entry("username", "jane_doe"),
Map.entry("email", "jane@example.com"),
Map.entry("status", "active")
))
.build());
}
}
resources:
# Create a datastore and add items to it
example:
type: datadog:Datastore
properties:
name: users-datastore
description: Datastore for user data
primaryColumnName: id
primaryKeyGenerationStrategy: none
# Create a datastore item with the primary key specified in the value map
user1:
type: datadog:DatastoreItem
properties:
datastoreId: ${example.id}
itemKey: user-123
value:
id: user-123
username: john_doe
email: john@example.com
status: active
# Create another datastore item
user2:
type: datadog:DatastoreItem
properties:
datastoreId: ${example.id}
itemKey: user-456
value:
id: user-456
username: jane_doe
email: jane@example.com
status: active
Create DatastoreItem Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new DatastoreItem(name: string, args: DatastoreItemArgs, opts?: CustomResourceOptions);@overload
def DatastoreItem(resource_name: str,
args: DatastoreItemArgs,
opts: Optional[ResourceOptions] = None)
@overload
def DatastoreItem(resource_name: str,
opts: Optional[ResourceOptions] = None,
datastore_id: Optional[str] = None,
item_key: Optional[str] = None,
value: Optional[Mapping[str, str]] = None)func NewDatastoreItem(ctx *Context, name string, args DatastoreItemArgs, opts ...ResourceOption) (*DatastoreItem, error)public DatastoreItem(string name, DatastoreItemArgs args, CustomResourceOptions? opts = null)
public DatastoreItem(String name, DatastoreItemArgs args)
public DatastoreItem(String name, DatastoreItemArgs args, CustomResourceOptions options)
type: datadog:DatastoreItem
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 DatastoreItemArgs
- 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 DatastoreItemArgs
- 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 DatastoreItemArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args DatastoreItemArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args DatastoreItemArgs
- 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 datastoreItemResource = new Datadog.DatastoreItem("datastoreItemResource", new()
{
DatastoreId = "string",
ItemKey = "string",
Value =
{
{ "string", "string" },
},
});
example, err := datadog.NewDatastoreItem(ctx, "datastoreItemResource", &datadog.DatastoreItemArgs{
DatastoreId: pulumi.String("string"),
ItemKey: pulumi.String("string"),
Value: pulumi.StringMap{
"string": pulumi.String("string"),
},
})
var datastoreItemResource = new DatastoreItem("datastoreItemResource", DatastoreItemArgs.builder()
.datastoreId("string")
.itemKey("string")
.value(Map.of("string", "string"))
.build());
datastore_item_resource = datadog.DatastoreItem("datastoreItemResource",
datastore_id="string",
item_key="string",
value={
"string": "string",
})
const datastoreItemResource = new datadog.DatastoreItem("datastoreItemResource", {
datastoreId: "string",
itemKey: "string",
value: {
string: "string",
},
});
type: datadog:DatastoreItem
properties:
datastoreId: string
itemKey: string
value:
string: string
DatastoreItem 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 DatastoreItem resource accepts the following input properties:
- Datastore
Id string - The unique identifier of the datastore containing this item.
- Item
Key string - The primary key value that identifies this item. Cannot exceed 256 characters.
- Value Dictionary<string, string>
- The data content (as key-value pairs) of the datastore item.
- Datastore
Id string - The unique identifier of the datastore containing this item.
- Item
Key string - The primary key value that identifies this item. Cannot exceed 256 characters.
- Value map[string]string
- The data content (as key-value pairs) of the datastore item.
- datastore
Id String - The unique identifier of the datastore containing this item.
- item
Key String - The primary key value that identifies this item. Cannot exceed 256 characters.
- value Map<String,String>
- The data content (as key-value pairs) of the datastore item.
- datastore
Id string - The unique identifier of the datastore containing this item.
- item
Key string - The primary key value that identifies this item. Cannot exceed 256 characters.
- value {[key: string]: string}
- The data content (as key-value pairs) of the datastore item.
- datastore_
id str - The unique identifier of the datastore containing this item.
- item_
key str - The primary key value that identifies this item. Cannot exceed 256 characters.
- value Mapping[str, str]
- The data content (as key-value pairs) of the datastore item.
- datastore
Id String - The unique identifier of the datastore containing this item.
- item
Key String - The primary key value that identifies this item. Cannot exceed 256 characters.
- value Map<String>
- The data content (as key-value pairs) of the datastore item.
Outputs
All input properties are implicitly available as output properties. Additionally, the DatastoreItem 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 DatastoreItem Resource
Get an existing DatastoreItem 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?: DatastoreItemState, opts?: CustomResourceOptions): DatastoreItem@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
datastore_id: Optional[str] = None,
item_key: Optional[str] = None,
value: Optional[Mapping[str, str]] = None) -> DatastoreItemfunc GetDatastoreItem(ctx *Context, name string, id IDInput, state *DatastoreItemState, opts ...ResourceOption) (*DatastoreItem, error)public static DatastoreItem Get(string name, Input<string> id, DatastoreItemState? state, CustomResourceOptions? opts = null)public static DatastoreItem get(String name, Output<String> id, DatastoreItemState state, CustomResourceOptions options)resources: _: type: datadog:DatastoreItem 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.
- Datastore
Id string - The unique identifier of the datastore containing this item.
- Item
Key string - The primary key value that identifies this item. Cannot exceed 256 characters.
- Value Dictionary<string, string>
- The data content (as key-value pairs) of the datastore item.
- Datastore
Id string - The unique identifier of the datastore containing this item.
- Item
Key string - The primary key value that identifies this item. Cannot exceed 256 characters.
- Value map[string]string
- The data content (as key-value pairs) of the datastore item.
- datastore
Id String - The unique identifier of the datastore containing this item.
- item
Key String - The primary key value that identifies this item. Cannot exceed 256 characters.
- value Map<String,String>
- The data content (as key-value pairs) of the datastore item.
- datastore
Id string - The unique identifier of the datastore containing this item.
- item
Key string - The primary key value that identifies this item. Cannot exceed 256 characters.
- value {[key: string]: string}
- The data content (as key-value pairs) of the datastore item.
- datastore_
id str - The unique identifier of the datastore containing this item.
- item_
key str - The primary key value that identifies this item. Cannot exceed 256 characters.
- value Mapping[str, str]
- The data content (as key-value pairs) of the datastore item.
- datastore
Id String - The unique identifier of the datastore containing this item.
- item
Key String - The primary key value that identifies this item. Cannot exceed 256 characters.
- value Map<String>
- The data content (as key-value pairs) of the datastore item.
Import
The pulumi import command can be used, for example:
$ pulumi import datadog:index/datastoreItem:DatastoreItem foo "datastore-id:item-key"
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Datadog pulumi/pulumi-datadog
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
datadogTerraform Provider.
