1. Packages
  2. OVH
  3. API Docs
  4. CloudProjectDatabase
  5. OpensearchPattern
OVHCloud v2.1.1 published on Thursday, Apr 10, 2025 by OVHcloud

ovh.CloudProjectDatabase.OpensearchPattern

Explore with Pulumi AI

Creates a pattern for a opensearch cluster associated with a public cloud project.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as ovh from "@ovhcloud/pulumi-ovh";
import * as ovh from "@pulumi/ovh";

const opensearch = ovh.CloudProjectDatabase.getDatabase({
    serviceName: "XXX",
    engine: "opensearch",
    id: "ZZZ",
});
const pattern = new ovh.cloudprojectdatabase.OpensearchPattern("pattern", {
    serviceName: opensearch.then(opensearch => opensearch.serviceName),
    clusterId: opensearch.then(opensearch => opensearch.id),
    maxIndexCount: 2,
    pattern: "logs_*",
});
Copy
import pulumi
import pulumi_ovh as ovh

opensearch = ovh.CloudProjectDatabase.get_database(service_name="XXX",
    engine="opensearch",
    id="ZZZ")
pattern = ovh.cloud_project_database.OpensearchPattern("pattern",
    service_name=opensearch.service_name,
    cluster_id=opensearch.id,
    max_index_count=2,
    pattern="logs_*")
Copy
package main

import (
	"github.com/ovh/pulumi-ovh/sdk/v2/go/ovh/cloudprojectdatabase"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		opensearch, err := cloudprojectdatabase.GetDatabase(ctx, &cloudprojectdatabase.GetDatabaseArgs{
			ServiceName: "XXX",
			Engine:      "opensearch",
			Id:          "ZZZ",
		}, nil)
		if err != nil {
			return err
		}
		_, err = cloudprojectdatabase.NewOpensearchPattern(ctx, "pattern", &cloudprojectdatabase.OpensearchPatternArgs{
			ServiceName:   pulumi.String(opensearch.ServiceName),
			ClusterId:     pulumi.String(opensearch.Id),
			MaxIndexCount: pulumi.Int(2),
			Pattern:       pulumi.String("logs_*"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Ovh = Pulumi.Ovh;

return await Deployment.RunAsync(() => 
{
    var opensearch = Ovh.CloudProjectDatabase.GetDatabase.Invoke(new()
    {
        ServiceName = "XXX",
        Engine = "opensearch",
        Id = "ZZZ",
    });

    var pattern = new Ovh.CloudProjectDatabase.OpensearchPattern("pattern", new()
    {
        ServiceName = opensearch.Apply(getDatabaseResult => getDatabaseResult.ServiceName),
        ClusterId = opensearch.Apply(getDatabaseResult => getDatabaseResult.Id),
        MaxIndexCount = 2,
        Pattern = "logs_*",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.ovh.CloudProjectDatabase.CloudProjectDatabaseFunctions;
import com.pulumi.ovh.CloudProjectDatabase.inputs.GetDatabaseArgs;
import com.ovhcloud.pulumi.ovh.CloudProjectDatabase.OpensearchPattern;
import com.ovhcloud.pulumi.ovh.CloudProjectDatabase.OpensearchPatternArgs;
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) {
        final var opensearch = CloudProjectDatabaseFunctions.getDatabase(GetDatabaseArgs.builder()
            .serviceName("XXX")
            .engine("opensearch")
            .id("ZZZ")
            .build());

        var pattern = new OpensearchPattern("pattern", OpensearchPatternArgs.builder()
            .serviceName(opensearch.serviceName())
            .clusterId(opensearch.id())
            .maxIndexCount(2)
            .pattern("logs_*")
            .build());

    }
}
Copy
resources:
  pattern:
    type: ovh:CloudProjectDatabase:OpensearchPattern
    properties:
      serviceName: ${opensearch.serviceName}
      clusterId: ${opensearch.id}
      maxIndexCount: 2
      pattern: logs_*
variables:
  opensearch:
    fn::invoke:
      function: ovh:CloudProjectDatabase:getDatabase
      arguments:
        serviceName: XXX
        engine: opensearch
        id: ZZZ
Copy

Create OpensearchPattern Resource

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

Constructor syntax

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

@overload
def OpensearchPattern(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      cluster_id: Optional[str] = None,
                      pattern: Optional[str] = None,
                      service_name: Optional[str] = None,
                      max_index_count: Optional[int] = None)
func NewOpensearchPattern(ctx *Context, name string, args OpensearchPatternArgs, opts ...ResourceOption) (*OpensearchPattern, error)
public OpensearchPattern(string name, OpensearchPatternArgs args, CustomResourceOptions? opts = null)
public OpensearchPattern(String name, OpensearchPatternArgs args)
public OpensearchPattern(String name, OpensearchPatternArgs args, CustomResourceOptions options)
type: ovh:CloudProjectDatabase:OpensearchPattern
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 This property is required. OpensearchPatternArgs
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 This property is required. OpensearchPatternArgs
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 This property is required. OpensearchPatternArgs
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 This property is required. OpensearchPatternArgs
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. OpensearchPatternArgs
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 opensearchPatternResource = new Ovh.CloudProjectDatabase.OpensearchPattern("opensearchPatternResource", new()
{
    ClusterId = "string",
    Pattern = "string",
    ServiceName = "string",
    MaxIndexCount = 0,
});
Copy
example, err := CloudProjectDatabase.NewOpensearchPattern(ctx, "opensearchPatternResource", &CloudProjectDatabase.OpensearchPatternArgs{
	ClusterId:     pulumi.String("string"),
	Pattern:       pulumi.String("string"),
	ServiceName:   pulumi.String("string"),
	MaxIndexCount: pulumi.Int(0),
})
Copy
var opensearchPatternResource = new OpensearchPattern("opensearchPatternResource", OpensearchPatternArgs.builder()
    .clusterId("string")
    .pattern("string")
    .serviceName("string")
    .maxIndexCount(0)
    .build());
Copy
opensearch_pattern_resource = ovh.cloud_project_database.OpensearchPattern("opensearchPatternResource",
    cluster_id="string",
    pattern="string",
    service_name="string",
    max_index_count=0)
Copy
const opensearchPatternResource = new ovh.cloudprojectdatabase.OpensearchPattern("opensearchPatternResource", {
    clusterId: "string",
    pattern: "string",
    serviceName: "string",
    maxIndexCount: 0,
});
Copy
type: ovh:CloudProjectDatabase:OpensearchPattern
properties:
    clusterId: string
    maxIndexCount: 0
    pattern: string
    serviceName: string
Copy

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

ClusterId
This property is required.
Changes to this property will trigger replacement.
string
Cluster ID.
Pattern
This property is required.
Changes to this property will trigger replacement.
string
Pattern format.
ServiceName
This property is required.
Changes to this property will trigger replacement.
string
The id of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
MaxIndexCount Changes to this property will trigger replacement. int
Maximum number of index for this pattern.
ClusterId
This property is required.
Changes to this property will trigger replacement.
string
Cluster ID.
Pattern
This property is required.
Changes to this property will trigger replacement.
string
Pattern format.
ServiceName
This property is required.
Changes to this property will trigger replacement.
string
The id of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
MaxIndexCount Changes to this property will trigger replacement. int
Maximum number of index for this pattern.
clusterId
This property is required.
Changes to this property will trigger replacement.
String
Cluster ID.
pattern
This property is required.
Changes to this property will trigger replacement.
String
Pattern format.
serviceName
This property is required.
Changes to this property will trigger replacement.
String
The id of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
maxIndexCount Changes to this property will trigger replacement. Integer
Maximum number of index for this pattern.
clusterId
This property is required.
Changes to this property will trigger replacement.
string
Cluster ID.
pattern
This property is required.
Changes to this property will trigger replacement.
string
Pattern format.
serviceName
This property is required.
Changes to this property will trigger replacement.
string
The id of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
maxIndexCount Changes to this property will trigger replacement. number
Maximum number of index for this pattern.
cluster_id
This property is required.
Changes to this property will trigger replacement.
str
Cluster ID.
pattern
This property is required.
Changes to this property will trigger replacement.
str
Pattern format.
service_name
This property is required.
Changes to this property will trigger replacement.
str
The id of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
max_index_count Changes to this property will trigger replacement. int
Maximum number of index for this pattern.
clusterId
This property is required.
Changes to this property will trigger replacement.
String
Cluster ID.
pattern
This property is required.
Changes to this property will trigger replacement.
String
Pattern format.
serviceName
This property is required.
Changes to this property will trigger replacement.
String
The id of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
maxIndexCount Changes to this property will trigger replacement. Number
Maximum number of index for this pattern.

Outputs

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

Get an existing OpensearchPattern 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?: OpensearchPatternState, opts?: CustomResourceOptions): OpensearchPattern
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        cluster_id: Optional[str] = None,
        max_index_count: Optional[int] = None,
        pattern: Optional[str] = None,
        service_name: Optional[str] = None) -> OpensearchPattern
func GetOpensearchPattern(ctx *Context, name string, id IDInput, state *OpensearchPatternState, opts ...ResourceOption) (*OpensearchPattern, error)
public static OpensearchPattern Get(string name, Input<string> id, OpensearchPatternState? state, CustomResourceOptions? opts = null)
public static OpensearchPattern get(String name, Output<String> id, OpensearchPatternState state, CustomResourceOptions options)
resources:  _:    type: ovh:CloudProjectDatabase:OpensearchPattern    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:
ClusterId Changes to this property will trigger replacement. string
Cluster ID.
MaxIndexCount Changes to this property will trigger replacement. int
Maximum number of index for this pattern.
Pattern Changes to this property will trigger replacement. string
Pattern format.
ServiceName Changes to this property will trigger replacement. string
The id of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
ClusterId Changes to this property will trigger replacement. string
Cluster ID.
MaxIndexCount Changes to this property will trigger replacement. int
Maximum number of index for this pattern.
Pattern Changes to this property will trigger replacement. string
Pattern format.
ServiceName Changes to this property will trigger replacement. string
The id of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
clusterId Changes to this property will trigger replacement. String
Cluster ID.
maxIndexCount Changes to this property will trigger replacement. Integer
Maximum number of index for this pattern.
pattern Changes to this property will trigger replacement. String
Pattern format.
serviceName Changes to this property will trigger replacement. String
The id of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
clusterId Changes to this property will trigger replacement. string
Cluster ID.
maxIndexCount Changes to this property will trigger replacement. number
Maximum number of index for this pattern.
pattern Changes to this property will trigger replacement. string
Pattern format.
serviceName Changes to this property will trigger replacement. string
The id of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
cluster_id Changes to this property will trigger replacement. str
Cluster ID.
max_index_count Changes to this property will trigger replacement. int
Maximum number of index for this pattern.
pattern Changes to this property will trigger replacement. str
Pattern format.
service_name Changes to this property will trigger replacement. str
The id of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
clusterId Changes to this property will trigger replacement. String
Cluster ID.
maxIndexCount Changes to this property will trigger replacement. Number
Maximum number of index for this pattern.
pattern Changes to this property will trigger replacement. String
Pattern format.
serviceName Changes to this property will trigger replacement. String
The id of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.

Import

OVHcloud Managed opensearch clusters patterns can be imported using the service_name, cluster_id and id of the pattern, separated by “/” E.g.,

bash

$ pulumi import ovh:CloudProjectDatabase/opensearchPattern:OpensearchPattern my_pattern service_name/cluster_id/id
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
ovh ovh/pulumi-ovh
License
Apache-2.0
Notes
This Pulumi package is based on the ovh Terraform Provider.