1. Packages
  2. Opensearch Provider
  3. API Docs
  4. DataStream
opensearch 2.3.1 published on Monday, Apr 14, 2025 by opensearch-project

opensearch.DataStream

Explore with Pulumi AI

A data stream lets you store append-only time series data across multiple (hidden, auto-generated) indices while giving you a single named resource for requests

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as opensearch from "@pulumi/opensearch";

const fooComposableIndexTemplate = new opensearch.ComposableIndexTemplate("fooComposableIndexTemplate", {body: `{
  "index_patterns": ["foo-data-stream*"],
  "data_stream": {}
}
`});
const fooDataStream = new opensearch.DataStream("fooDataStream", {}, {
    dependsOn: [fooComposableIndexTemplate],
});
Copy
import pulumi
import pulumi_opensearch as opensearch

foo_composable_index_template = opensearch.ComposableIndexTemplate("fooComposableIndexTemplate", body="""{
  "index_patterns": ["foo-data-stream*"],
  "data_stream": {}
}
""")
foo_data_stream = opensearch.DataStream("fooDataStream", opts = pulumi.ResourceOptions(depends_on=[foo_composable_index_template]))
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/opensearch/v2/opensearch"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		fooComposableIndexTemplate, err := opensearch.NewComposableIndexTemplate(ctx, "fooComposableIndexTemplate", &opensearch.ComposableIndexTemplateArgs{
			Body: pulumi.String("{\n  \"index_patterns\": [\"foo-data-stream*\"],\n  \"data_stream\": {}\n}\n"),
		})
		if err != nil {
			return err
		}
		_, err = opensearch.NewDataStream(ctx, "fooDataStream", nil, pulumi.DependsOn([]pulumi.Resource{
			fooComposableIndexTemplate,
		}))
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Opensearch = Pulumi.Opensearch;

return await Deployment.RunAsync(() => 
{
    var fooComposableIndexTemplate = new Opensearch.ComposableIndexTemplate("fooComposableIndexTemplate", new()
    {
        Body = @"{
  ""index_patterns"": [""foo-data-stream*""],
  ""data_stream"": {}
}
",
    });

    var fooDataStream = new Opensearch.DataStream("fooDataStream", new()
    {
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            fooComposableIndexTemplate,
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.opensearch.ComposableIndexTemplate;
import com.pulumi.opensearch.ComposableIndexTemplateArgs;
import com.pulumi.opensearch.DataStream;
import com.pulumi.opensearch.DataStreamArgs;
import com.pulumi.resources.CustomResourceOptions;
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 fooComposableIndexTemplate = new ComposableIndexTemplate("fooComposableIndexTemplate", ComposableIndexTemplateArgs.builder()
            .body("""
{
  "index_patterns": ["foo-data-stream*"],
  "data_stream": {}
}
            """)
            .build());

        var fooDataStream = new DataStream("fooDataStream", DataStreamArgs.Empty, CustomResourceOptions.builder()
            .dependsOn(fooComposableIndexTemplate)
            .build());

    }
}
Copy
resources:
  fooComposableIndexTemplate:
    type: opensearch:ComposableIndexTemplate
    properties:
      body: |
        {
          "index_patterns": ["foo-data-stream*"],
          "data_stream": {}
        }        
  fooDataStream:
    type: opensearch:DataStream
    options:
      dependsOn:
        - ${fooComposableIndexTemplate}
Copy

Create DataStream Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new DataStream(name: string, args?: DataStreamArgs, opts?: CustomResourceOptions);
@overload
def DataStream(resource_name: str,
               args: Optional[DataStreamArgs] = None,
               opts: Optional[ResourceOptions] = None)

@overload
def DataStream(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               data_stream_id: Optional[str] = None,
               name: Optional[str] = None)
func NewDataStream(ctx *Context, name string, args *DataStreamArgs, opts ...ResourceOption) (*DataStream, error)
public DataStream(string name, DataStreamArgs? args = null, CustomResourceOptions? opts = null)
public DataStream(String name, DataStreamArgs args)
public DataStream(String name, DataStreamArgs args, CustomResourceOptions options)
type: opensearch:DataStream
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args DataStreamArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args DataStreamArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args DataStreamArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args DataStreamArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. DataStreamArgs
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 dataStreamResource = new Opensearch.DataStream("dataStreamResource", new()
{
    DataStreamId = "string",
    Name = "string",
});
Copy
example, err := opensearch.NewDataStream(ctx, "dataStreamResource", &opensearch.DataStreamArgs{
DataStreamId: pulumi.String("string"),
Name: pulumi.String("string"),
})
Copy
var dataStreamResource = new DataStream("dataStreamResource", DataStreamArgs.builder()
    .dataStreamId("string")
    .name("string")
    .build());
Copy
data_stream_resource = opensearch.DataStream("dataStreamResource",
    data_stream_id="string",
    name="string")
Copy
const dataStreamResource = new opensearch.DataStream("dataStreamResource", {
    dataStreamId: "string",
    name: "string",
});
Copy
type: opensearch:DataStream
properties:
    dataStreamId: string
    name: string
Copy

DataStream 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 DataStream resource accepts the following input properties:

DataStreamId string
The ID of this resource.
Name string
Name of the data stream to create, must have a matching
DataStreamId string
The ID of this resource.
Name string
Name of the data stream to create, must have a matching
dataStreamId String
The ID of this resource.
name String
Name of the data stream to create, must have a matching
dataStreamId string
The ID of this resource.
name string
Name of the data stream to create, must have a matching
data_stream_id str
The ID of this resource.
name str
Name of the data stream to create, must have a matching
dataStreamId String
The ID of this resource.
name String
Name of the data stream to create, must have a matching

Outputs

All input properties are implicitly available as output properties. Additionally, the DataStream 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 DataStream Resource

Get an existing DataStream 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?: DataStreamState, opts?: CustomResourceOptions): DataStream
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        data_stream_id: Optional[str] = None,
        name: Optional[str] = None) -> DataStream
func GetDataStream(ctx *Context, name string, id IDInput, state *DataStreamState, opts ...ResourceOption) (*DataStream, error)
public static DataStream Get(string name, Input<string> id, DataStreamState? state, CustomResourceOptions? opts = null)
public static DataStream get(String name, Output<String> id, DataStreamState state, CustomResourceOptions options)
resources:  _:    type: opensearch:DataStream    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
DataStreamId string
The ID of this resource.
Name string
Name of the data stream to create, must have a matching
DataStreamId string
The ID of this resource.
Name string
Name of the data stream to create, must have a matching
dataStreamId String
The ID of this resource.
name String
Name of the data stream to create, must have a matching
dataStreamId string
The ID of this resource.
name string
Name of the data stream to create, must have a matching
data_stream_id str
The ID of this resource.
name str
Name of the data stream to create, must have a matching
dataStreamId String
The ID of this resource.
name String
Name of the data stream to create, must have a matching

Package Details

Repository
opensearch opensearch-project/terraform-provider-opensearch
License
Notes
This Pulumi package is based on the opensearch Terraform Provider.