alicloud.ots.SecondaryIndex
Explore with Pulumi AI
Provides an OTS secondary index resource.
For information about OTS secondary index and how to use it, see Secondary index overview.
NOTE: Available since v1.187.0.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
import * as random from "@pulumi/random";
const config = new pulumi.Config();
const name = config.get("name") || "tf-example";
const _default = new random.index.Integer("default", {
min: 10000,
max: 99999,
});
const defaultInstance = new alicloud.ots.Instance("default", {
name: `${name}-${_default.result}`,
description: name,
accessedBy: "Any",
tags: {
Created: "TF",
For: "example",
},
});
const defaultTable = new alicloud.ots.Table("default", {
instanceName: defaultInstance.name,
tableName: "tf_example",
timeToLive: -1,
maxVersion: 1,
enableSse: true,
sseKeyType: "SSE_KMS_SERVICE",
primaryKeys: [
{
name: "pk1",
type: "Integer",
},
{
name: "pk2",
type: "String",
},
{
name: "pk3",
type: "Binary",
},
],
definedColumns: [
{
name: "col1",
type: "Integer",
},
{
name: "col2",
type: "String",
},
{
name: "col3",
type: "Binary",
},
],
});
const defaultSecondaryIndex = new alicloud.ots.SecondaryIndex("default", {
instanceName: defaultInstance.name,
tableName: defaultTable.tableName,
indexName: "example_index",
indexType: "Global",
includeBaseData: true,
primaryKeys: [
"pk1",
"pk2",
"pk3",
],
definedColumns: [
"col1",
"col2",
"col3",
],
});
import pulumi
import pulumi_alicloud as alicloud
import pulumi_random as random
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "tf-example"
default = random.index.Integer("default",
min=10000,
max=99999)
default_instance = alicloud.ots.Instance("default",
name=f"{name}-{default['result']}",
description=name,
accessed_by="Any",
tags={
"Created": "TF",
"For": "example",
})
default_table = alicloud.ots.Table("default",
instance_name=default_instance.name,
table_name="tf_example",
time_to_live=-1,
max_version=1,
enable_sse=True,
sse_key_type="SSE_KMS_SERVICE",
primary_keys=[
alicloud.ots.TablePrimaryKeyArgs(
name="pk1",
type="Integer",
),
alicloud.ots.TablePrimaryKeyArgs(
name="pk2",
type="String",
),
alicloud.ots.TablePrimaryKeyArgs(
name="pk3",
type="Binary",
),
],
defined_columns=[
alicloud.ots.TableDefinedColumnArgs(
name="col1",
type="Integer",
),
alicloud.ots.TableDefinedColumnArgs(
name="col2",
type="String",
),
alicloud.ots.TableDefinedColumnArgs(
name="col3",
type="Binary",
),
])
default_secondary_index = alicloud.ots.SecondaryIndex("default",
instance_name=default_instance.name,
table_name=default_table.table_name,
index_name="example_index",
index_type="Global",
include_base_data=True,
primary_keys=[
"pk1",
"pk2",
"pk3",
],
defined_columns=[
"col1",
"col2",
"col3",
])
package main
import (
"fmt"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ots"
"github.com/pulumi/pulumi-random/sdk/v4/go/random"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cfg := config.New(ctx, "")
name := "tf-example"
if param := cfg.Get("name"); param != "" {
name = param
}
_, err := random.NewInteger(ctx, "default", &random.IntegerArgs{
Min: 10000,
Max: 99999,
})
if err != nil {
return err
}
defaultInstance, err := ots.NewInstance(ctx, "default", &ots.InstanceArgs{
Name: pulumi.String(fmt.Sprintf("%v-%v", name, _default.Result)),
Description: pulumi.String(name),
AccessedBy: pulumi.String("Any"),
Tags: pulumi.Map{
"Created": pulumi.Any("TF"),
"For": pulumi.Any("example"),
},
})
if err != nil {
return err
}
defaultTable, err := ots.NewTable(ctx, "default", &ots.TableArgs{
InstanceName: defaultInstance.Name,
TableName: pulumi.String("tf_example"),
TimeToLive: -1,
MaxVersion: pulumi.Int(1),
EnableSse: pulumi.Bool(true),
SseKeyType: pulumi.String("SSE_KMS_SERVICE"),
PrimaryKeys: ots.TablePrimaryKeyArray{
&ots.TablePrimaryKeyArgs{
Name: pulumi.String("pk1"),
Type: pulumi.String("Integer"),
},
&ots.TablePrimaryKeyArgs{
Name: pulumi.String("pk2"),
Type: pulumi.String("String"),
},
&ots.TablePrimaryKeyArgs{
Name: pulumi.String("pk3"),
Type: pulumi.String("Binary"),
},
},
DefinedColumns: ots.TableDefinedColumnArray{
&ots.TableDefinedColumnArgs{
Name: pulumi.String("col1"),
Type: pulumi.String("Integer"),
},
&ots.TableDefinedColumnArgs{
Name: pulumi.String("col2"),
Type: pulumi.String("String"),
},
&ots.TableDefinedColumnArgs{
Name: pulumi.String("col3"),
Type: pulumi.String("Binary"),
},
},
})
if err != nil {
return err
}
_, err = ots.NewSecondaryIndex(ctx, "default", &ots.SecondaryIndexArgs{
InstanceName: defaultInstance.Name,
TableName: defaultTable.TableName,
IndexName: pulumi.String("example_index"),
IndexType: pulumi.String("Global"),
IncludeBaseData: pulumi.Bool(true),
PrimaryKeys: pulumi.StringArray{
pulumi.String("pk1"),
pulumi.String("pk2"),
pulumi.String("pk3"),
},
DefinedColumns: pulumi.StringArray{
pulumi.String("col1"),
pulumi.String("col2"),
pulumi.String("col3"),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
using Random = Pulumi.Random;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var name = config.Get("name") ?? "tf-example";
var @default = new Random.Index.Integer("default", new()
{
Min = 10000,
Max = 99999,
});
var defaultInstance = new AliCloud.Ots.Instance("default", new()
{
Name = $"{name}-{@default.Result}",
Description = name,
AccessedBy = "Any",
Tags =
{
{ "Created", "TF" },
{ "For", "example" },
},
});
var defaultTable = new AliCloud.Ots.Table("default", new()
{
InstanceName = defaultInstance.Name,
TableName = "tf_example",
TimeToLive = -1,
MaxVersion = 1,
EnableSse = true,
SseKeyType = "SSE_KMS_SERVICE",
PrimaryKeys = new[]
{
new AliCloud.Ots.Inputs.TablePrimaryKeyArgs
{
Name = "pk1",
Type = "Integer",
},
new AliCloud.Ots.Inputs.TablePrimaryKeyArgs
{
Name = "pk2",
Type = "String",
},
new AliCloud.Ots.Inputs.TablePrimaryKeyArgs
{
Name = "pk3",
Type = "Binary",
},
},
DefinedColumns = new[]
{
new AliCloud.Ots.Inputs.TableDefinedColumnArgs
{
Name = "col1",
Type = "Integer",
},
new AliCloud.Ots.Inputs.TableDefinedColumnArgs
{
Name = "col2",
Type = "String",
},
new AliCloud.Ots.Inputs.TableDefinedColumnArgs
{
Name = "col3",
Type = "Binary",
},
},
});
var defaultSecondaryIndex = new AliCloud.Ots.SecondaryIndex("default", new()
{
InstanceName = defaultInstance.Name,
TableName = defaultTable.TableName,
IndexName = "example_index",
IndexType = "Global",
IncludeBaseData = true,
PrimaryKeys = new[]
{
"pk1",
"pk2",
"pk3",
},
DefinedColumns = new[]
{
"col1",
"col2",
"col3",
},
});
});
Coming soon!
configuration:
name:
type: string
default: tf-example
resources:
default:
type: random:integer
properties:
min: 10000
max: 99999
defaultInstance:
type: alicloud:ots:Instance
name: default
properties:
name: ${name}-${default.result}
description: ${name}
accessedBy: Any
tags:
Created: TF
For: example
defaultTable:
type: alicloud:ots:Table
name: default
properties:
instanceName: ${defaultInstance.name}
tableName: tf_example
timeToLive: -1
maxVersion: 1
enableSse: true
sseKeyType: SSE_KMS_SERVICE
primaryKeys:
- name: pk1
type: Integer
- name: pk2
type: String
- name: pk3
type: Binary
definedColumns:
- name: col1
type: Integer
- name: col2
type: String
- name: col3
type: Binary
defaultSecondaryIndex:
type: alicloud:ots:SecondaryIndex
name: default
properties:
instanceName: ${defaultInstance.name}
tableName: ${defaultTable.tableName}
indexName: example_index
indexType: Global
includeBaseData: true
primaryKeys:
- pk1
- pk2
- pk3
definedColumns:
- col1
- col2
- col3
Create SecondaryIndex Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new SecondaryIndex(name: string, args: SecondaryIndexArgs, opts?: CustomResourceOptions);
@overload
def SecondaryIndex(resource_name: str,
args: SecondaryIndexArgs,
opts: Optional[ResourceOptions] = None)
@overload
def SecondaryIndex(resource_name: str,
opts: Optional[ResourceOptions] = None,
include_base_data: Optional[bool] = None,
index_name: Optional[str] = None,
index_type: Optional[str] = None,
instance_name: Optional[str] = None,
primary_keys: Optional[Sequence[str]] = None,
table_name: Optional[str] = None,
defined_columns: Optional[Sequence[str]] = None)
func NewSecondaryIndex(ctx *Context, name string, args SecondaryIndexArgs, opts ...ResourceOption) (*SecondaryIndex, error)
public SecondaryIndex(string name, SecondaryIndexArgs args, CustomResourceOptions? opts = null)
public SecondaryIndex(String name, SecondaryIndexArgs args)
public SecondaryIndex(String name, SecondaryIndexArgs args, CustomResourceOptions options)
type: alicloud:ots:SecondaryIndex
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 SecondaryIndexArgs
- 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 SecondaryIndexArgs
- 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 SecondaryIndexArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args SecondaryIndexArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args SecondaryIndexArgs
- 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 secondaryIndexResource = new AliCloud.Ots.SecondaryIndex("secondaryIndexResource", new()
{
IncludeBaseData = false,
IndexName = "string",
IndexType = "string",
InstanceName = "string",
PrimaryKeys = new[]
{
"string",
},
TableName = "string",
DefinedColumns = new[]
{
"string",
},
});
example, err := ots.NewSecondaryIndex(ctx, "secondaryIndexResource", &ots.SecondaryIndexArgs{
IncludeBaseData: pulumi.Bool(false),
IndexName: pulumi.String("string"),
IndexType: pulumi.String("string"),
InstanceName: pulumi.String("string"),
PrimaryKeys: pulumi.StringArray{
pulumi.String("string"),
},
TableName: pulumi.String("string"),
DefinedColumns: pulumi.StringArray{
pulumi.String("string"),
},
})
var secondaryIndexResource = new SecondaryIndex("secondaryIndexResource", SecondaryIndexArgs.builder()
.includeBaseData(false)
.indexName("string")
.indexType("string")
.instanceName("string")
.primaryKeys("string")
.tableName("string")
.definedColumns("string")
.build());
secondary_index_resource = alicloud.ots.SecondaryIndex("secondaryIndexResource",
include_base_data=False,
index_name="string",
index_type="string",
instance_name="string",
primary_keys=["string"],
table_name="string",
defined_columns=["string"])
const secondaryIndexResource = new alicloud.ots.SecondaryIndex("secondaryIndexResource", {
includeBaseData: false,
indexName: "string",
indexType: "string",
instanceName: "string",
primaryKeys: ["string"],
tableName: "string",
definedColumns: ["string"],
});
type: alicloud:ots:SecondaryIndex
properties:
definedColumns:
- string
includeBaseData: false
indexName: string
indexType: string
instanceName: string
primaryKeys:
- string
tableName: string
SecondaryIndex 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 SecondaryIndex resource accepts the following input properties:
- Include
Base boolData - whether the index contains data that already exists in the data table. When include_base_data is set to true, it means that stock data is included.
- Index
Name string - The index name of the OTS Table. If changed, a new index would be created.
- Index
Type string - The index type of the OTS Table. If changed, a new index would be created, only
Global
orLocal
is allowed. - Instance
Name string - The name of the OTS instance in which table will located.
- Primary
Keys List<string> - A list of primary keys for index, referenced from Table's primary keys or predefined columns.
- Table
Name string - The name of the OTS table. If changed, a new table would be created.
- Defined
Columns List<string> - A list of defined column for index, referenced from Table's primary keys or predefined columns.
- Include
Base boolData - whether the index contains data that already exists in the data table. When include_base_data is set to true, it means that stock data is included.
- Index
Name string - The index name of the OTS Table. If changed, a new index would be created.
- Index
Type string - The index type of the OTS Table. If changed, a new index would be created, only
Global
orLocal
is allowed. - Instance
Name string - The name of the OTS instance in which table will located.
- Primary
Keys []string - A list of primary keys for index, referenced from Table's primary keys or predefined columns.
- Table
Name string - The name of the OTS table. If changed, a new table would be created.
- Defined
Columns []string - A list of defined column for index, referenced from Table's primary keys or predefined columns.
- include
Base BooleanData - whether the index contains data that already exists in the data table. When include_base_data is set to true, it means that stock data is included.
- index
Name String - The index name of the OTS Table. If changed, a new index would be created.
- index
Type String - The index type of the OTS Table. If changed, a new index would be created, only
Global
orLocal
is allowed. - instance
Name String - The name of the OTS instance in which table will located.
- primary
Keys List<String> - A list of primary keys for index, referenced from Table's primary keys or predefined columns.
- table
Name String - The name of the OTS table. If changed, a new table would be created.
- defined
Columns List<String> - A list of defined column for index, referenced from Table's primary keys or predefined columns.
- include
Base booleanData - whether the index contains data that already exists in the data table. When include_base_data is set to true, it means that stock data is included.
- index
Name string - The index name of the OTS Table. If changed, a new index would be created.
- index
Type string - The index type of the OTS Table. If changed, a new index would be created, only
Global
orLocal
is allowed. - instance
Name string - The name of the OTS instance in which table will located.
- primary
Keys string[] - A list of primary keys for index, referenced from Table's primary keys or predefined columns.
- table
Name string - The name of the OTS table. If changed, a new table would be created.
- defined
Columns string[] - A list of defined column for index, referenced from Table's primary keys or predefined columns.
- include_
base_ booldata - whether the index contains data that already exists in the data table. When include_base_data is set to true, it means that stock data is included.
- index_
name str - The index name of the OTS Table. If changed, a new index would be created.
- index_
type str - The index type of the OTS Table. If changed, a new index would be created, only
Global
orLocal
is allowed. - instance_
name str - The name of the OTS instance in which table will located.
- primary_
keys Sequence[str] - A list of primary keys for index, referenced from Table's primary keys or predefined columns.
- table_
name str - The name of the OTS table. If changed, a new table would be created.
- defined_
columns Sequence[str] - A list of defined column for index, referenced from Table's primary keys or predefined columns.
- include
Base BooleanData - whether the index contains data that already exists in the data table. When include_base_data is set to true, it means that stock data is included.
- index
Name String - The index name of the OTS Table. If changed, a new index would be created.
- index
Type String - The index type of the OTS Table. If changed, a new index would be created, only
Global
orLocal
is allowed. - instance
Name String - The name of the OTS instance in which table will located.
- primary
Keys List<String> - A list of primary keys for index, referenced from Table's primary keys or predefined columns.
- table
Name String - The name of the OTS table. If changed, a new table would be created.
- defined
Columns List<String> - A list of defined column for index, referenced from Table's primary keys or predefined columns.
Outputs
All input properties are implicitly available as output properties. Additionally, the SecondaryIndex 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 SecondaryIndex Resource
Get an existing SecondaryIndex 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?: SecondaryIndexState, opts?: CustomResourceOptions): SecondaryIndex
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
defined_columns: Optional[Sequence[str]] = None,
include_base_data: Optional[bool] = None,
index_name: Optional[str] = None,
index_type: Optional[str] = None,
instance_name: Optional[str] = None,
primary_keys: Optional[Sequence[str]] = None,
table_name: Optional[str] = None) -> SecondaryIndex
func GetSecondaryIndex(ctx *Context, name string, id IDInput, state *SecondaryIndexState, opts ...ResourceOption) (*SecondaryIndex, error)
public static SecondaryIndex Get(string name, Input<string> id, SecondaryIndexState? state, CustomResourceOptions? opts = null)
public static SecondaryIndex get(String name, Output<String> id, SecondaryIndexState 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.
- Defined
Columns List<string> - A list of defined column for index, referenced from Table's primary keys or predefined columns.
- Include
Base boolData - whether the index contains data that already exists in the data table. When include_base_data is set to true, it means that stock data is included.
- Index
Name string - The index name of the OTS Table. If changed, a new index would be created.
- Index
Type string - The index type of the OTS Table. If changed, a new index would be created, only
Global
orLocal
is allowed. - Instance
Name string - The name of the OTS instance in which table will located.
- Primary
Keys List<string> - A list of primary keys for index, referenced from Table's primary keys or predefined columns.
- Table
Name string - The name of the OTS table. If changed, a new table would be created.
- Defined
Columns []string - A list of defined column for index, referenced from Table's primary keys or predefined columns.
- Include
Base boolData - whether the index contains data that already exists in the data table. When include_base_data is set to true, it means that stock data is included.
- Index
Name string - The index name of the OTS Table. If changed, a new index would be created.
- Index
Type string - The index type of the OTS Table. If changed, a new index would be created, only
Global
orLocal
is allowed. - Instance
Name string - The name of the OTS instance in which table will located.
- Primary
Keys []string - A list of primary keys for index, referenced from Table's primary keys or predefined columns.
- Table
Name string - The name of the OTS table. If changed, a new table would be created.
- defined
Columns List<String> - A list of defined column for index, referenced from Table's primary keys or predefined columns.
- include
Base BooleanData - whether the index contains data that already exists in the data table. When include_base_data is set to true, it means that stock data is included.
- index
Name String - The index name of the OTS Table. If changed, a new index would be created.
- index
Type String - The index type of the OTS Table. If changed, a new index would be created, only
Global
orLocal
is allowed. - instance
Name String - The name of the OTS instance in which table will located.
- primary
Keys List<String> - A list of primary keys for index, referenced from Table's primary keys or predefined columns.
- table
Name String - The name of the OTS table. If changed, a new table would be created.
- defined
Columns string[] - A list of defined column for index, referenced from Table's primary keys or predefined columns.
- include
Base booleanData - whether the index contains data that already exists in the data table. When include_base_data is set to true, it means that stock data is included.
- index
Name string - The index name of the OTS Table. If changed, a new index would be created.
- index
Type string - The index type of the OTS Table. If changed, a new index would be created, only
Global
orLocal
is allowed. - instance
Name string - The name of the OTS instance in which table will located.
- primary
Keys string[] - A list of primary keys for index, referenced from Table's primary keys or predefined columns.
- table
Name string - The name of the OTS table. If changed, a new table would be created.
- defined_
columns Sequence[str] - A list of defined column for index, referenced from Table's primary keys or predefined columns.
- include_
base_ booldata - whether the index contains data that already exists in the data table. When include_base_data is set to true, it means that stock data is included.
- index_
name str - The index name of the OTS Table. If changed, a new index would be created.
- index_
type str - The index type of the OTS Table. If changed, a new index would be created, only
Global
orLocal
is allowed. - instance_
name str - The name of the OTS instance in which table will located.
- primary_
keys Sequence[str] - A list of primary keys for index, referenced from Table's primary keys or predefined columns.
- table_
name str - The name of the OTS table. If changed, a new table would be created.
- defined
Columns List<String> - A list of defined column for index, referenced from Table's primary keys or predefined columns.
- include
Base BooleanData - whether the index contains data that already exists in the data table. When include_base_data is set to true, it means that stock data is included.
- index
Name String - The index name of the OTS Table. If changed, a new index would be created.
- index
Type String - The index type of the OTS Table. If changed, a new index would be created, only
Global
orLocal
is allowed. - instance
Name String - The name of the OTS instance in which table will located.
- primary
Keys List<String> - A list of primary keys for index, referenced from Table's primary keys or predefined columns.
- table
Name String - The name of the OTS table. If changed, a new table would be created.
Import
OTS secondary index can be imported using id, e.g.
$ pulumi import alicloud:ots/secondaryIndex:SecondaryIndex index1 <instance_name>:<table_name>:<index_name>:<index_type>
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloud
Terraform Provider.