SqlContainerArgs

data class SqlContainerArgs(val accountName: Output<String>? = null, val analyticalStorageTtl: Output<Int>? = null, val autoscaleSettings: Output<SqlContainerAutoscaleSettingsArgs>? = null, val conflictResolutionPolicy: Output<SqlContainerConflictResolutionPolicyArgs>? = null, val databaseName: Output<String>? = null, val defaultTtl: Output<Int>? = null, val indexingPolicy: Output<SqlContainerIndexingPolicyArgs>? = null, val name: Output<String>? = null, val partitionKeyKind: Output<String>? = null, val partitionKeyPaths: Output<List<String>>? = null, val partitionKeyVersion: Output<Int>? = null, val resourceGroupName: Output<String>? = null, val throughput: Output<Int>? = null, val uniqueKeys: Output<List<SqlContainerUniqueKeyArgs>>? = null) : ConvertibleToJava<SqlContainerArgs>

Manages a SQL Container within a Cosmos DB Account.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const example = azure.cosmosdb.getAccount({
name: "tfex-cosmosdb-account",
resourceGroupName: "tfex-cosmosdb-account-rg",
});
const exampleSqlDatabase = new azure.cosmosdb.SqlDatabase("example", {
name: "example-acsd",
resourceGroupName: example.then(example => example.resourceGroupName),
accountName: example.then(example => example.name),
});
const exampleSqlContainer = new azure.cosmosdb.SqlContainer("example", {
name: "example-container",
resourceGroupName: example.then(example => example.resourceGroupName),
accountName: example.then(example => example.name),
databaseName: exampleSqlDatabase.name,
partitionKeyPaths: ["/definition/id"],
partitionKeyVersion: 1,
throughput: 400,
indexingPolicy: {
indexingMode: "consistent",
includedPaths: [
{
path: "/*",
},
{
path: "/included/?",
},
],
excludedPaths: [{
path: "/excluded/?",
}],
},
uniqueKeys: [{
paths: [
"/definition/idlong",
"/definition/idshort",
],
}],
});
import pulumi
import pulumi_azure as azure
example = azure.cosmosdb.get_account(name="tfex-cosmosdb-account",
resource_group_name="tfex-cosmosdb-account-rg")
example_sql_database = azure.cosmosdb.SqlDatabase("example",
name="example-acsd",
resource_group_name=example.resource_group_name,
account_name=example.name)
example_sql_container = azure.cosmosdb.SqlContainer("example",
name="example-container",
resource_group_name=example.resource_group_name,
account_name=example.name,
database_name=example_sql_database.name,
partition_key_paths=["/definition/id"],
partition_key_version=1,
throughput=400,
indexing_policy={
"indexing_mode": "consistent",
"included_paths": [
{
"path": "/*",
},
{
"path": "/included/?",
},
],
"excluded_paths": [{
"path": "/excluded/?",
}],
},
unique_keys=[{
"paths": [
"/definition/idlong",
"/definition/idshort",
],
}])
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() =>
{
var example = Azure.CosmosDB.GetAccount.Invoke(new()
{
Name = "tfex-cosmosdb-account",
ResourceGroupName = "tfex-cosmosdb-account-rg",
});
var exampleSqlDatabase = new Azure.CosmosDB.SqlDatabase("example", new()
{
Name = "example-acsd",
ResourceGroupName = example.Apply(getAccountResult => getAccountResult.ResourceGroupName),
AccountName = example.Apply(getAccountResult => getAccountResult.Name),
});
var exampleSqlContainer = new Azure.CosmosDB.SqlContainer("example", new()
{
Name = "example-container",
ResourceGroupName = example.Apply(getAccountResult => getAccountResult.ResourceGroupName),
AccountName = example.Apply(getAccountResult => getAccountResult.Name),
DatabaseName = exampleSqlDatabase.Name,
PartitionKeyPaths = new[]
{
"/definition/id",
},
PartitionKeyVersion = 1,
Throughput = 400,
IndexingPolicy = new Azure.CosmosDB.Inputs.SqlContainerIndexingPolicyArgs
{
IndexingMode = "consistent",
IncludedPaths = new[]
{
new Azure.CosmosDB.Inputs.SqlContainerIndexingPolicyIncludedPathArgs
{
Path = "/*",
},
new Azure.CosmosDB.Inputs.SqlContainerIndexingPolicyIncludedPathArgs
{
Path = "/included/?",
},
},
ExcludedPaths = new[]
{
new Azure.CosmosDB.Inputs.SqlContainerIndexingPolicyExcludedPathArgs
{
Path = "/excluded/?",
},
},
},
UniqueKeys = new[]
{
new Azure.CosmosDB.Inputs.SqlContainerUniqueKeyArgs
{
Paths = new[]
{
"/definition/idlong",
"/definition/idshort",
},
},
},
});
});
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/cosmosdb"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := cosmosdb.LookupAccount(ctx, &cosmosdb.LookupAccountArgs{
Name: "tfex-cosmosdb-account",
ResourceGroupName: "tfex-cosmosdb-account-rg",
}, nil)
if err != nil {
return err
}
exampleSqlDatabase, err := cosmosdb.NewSqlDatabase(ctx, "example", &cosmosdb.SqlDatabaseArgs{
Name: pulumi.String("example-acsd"),
ResourceGroupName: pulumi.String(example.ResourceGroupName),
AccountName: pulumi.String(example.Name),
})
if err != nil {
return err
}
_, err = cosmosdb.NewSqlContainer(ctx, "example", &cosmosdb.SqlContainerArgs{
Name: pulumi.String("example-container"),
ResourceGroupName: pulumi.String(example.ResourceGroupName),
AccountName: pulumi.String(example.Name),
DatabaseName: exampleSqlDatabase.Name,
PartitionKeyPaths: pulumi.StringArray{
pulumi.String("/definition/id"),
},
PartitionKeyVersion: pulumi.Int(1),
Throughput: pulumi.Int(400),
IndexingPolicy: &cosmosdb.SqlContainerIndexingPolicyArgs{
IndexingMode: pulumi.String("consistent"),
IncludedPaths: cosmosdb.SqlContainerIndexingPolicyIncludedPathArray{
&cosmosdb.SqlContainerIndexingPolicyIncludedPathArgs{
Path: pulumi.String("/*"),
},
&cosmosdb.SqlContainerIndexingPolicyIncludedPathArgs{
Path: pulumi.String("/included/?"),
},
},
ExcludedPaths: cosmosdb.SqlContainerIndexingPolicyExcludedPathArray{
&cosmosdb.SqlContainerIndexingPolicyExcludedPathArgs{
Path: pulumi.String("/excluded/?"),
},
},
},
UniqueKeys: cosmosdb.SqlContainerUniqueKeyArray{
&cosmosdb.SqlContainerUniqueKeyArgs{
Paths: pulumi.StringArray{
pulumi.String("/definition/idlong"),
pulumi.String("/definition/idshort"),
},
},
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.cosmosdb.CosmosdbFunctions;
import com.pulumi.azure.cosmosdb.inputs.GetAccountArgs;
import com.pulumi.azure.cosmosdb.SqlDatabase;
import com.pulumi.azure.cosmosdb.SqlDatabaseArgs;
import com.pulumi.azure.cosmosdb.SqlContainer;
import com.pulumi.azure.cosmosdb.SqlContainerArgs;
import com.pulumi.azure.cosmosdb.inputs.SqlContainerIndexingPolicyArgs;
import com.pulumi.azure.cosmosdb.inputs.SqlContainerUniqueKeyArgs;
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 example = CosmosdbFunctions.getAccount(GetAccountArgs.builder()
.name("tfex-cosmosdb-account")
.resourceGroupName("tfex-cosmosdb-account-rg")
.build());
var exampleSqlDatabase = new SqlDatabase("exampleSqlDatabase", SqlDatabaseArgs.builder()
.name("example-acsd")
.resourceGroupName(example.resourceGroupName())
.accountName(example.name())
.build());
var exampleSqlContainer = new SqlContainer("exampleSqlContainer", SqlContainerArgs.builder()
.name("example-container")
.resourceGroupName(example.resourceGroupName())
.accountName(example.name())
.databaseName(exampleSqlDatabase.name())
.partitionKeyPaths("/definition/id")
.partitionKeyVersion(1)
.throughput(400)
.indexingPolicy(SqlContainerIndexingPolicyArgs.builder()
.indexingMode("consistent")
.includedPaths(
SqlContainerIndexingPolicyIncludedPathArgs.builder()
.path("/*")
.build(),
SqlContainerIndexingPolicyIncludedPathArgs.builder()
.path("/included/?")
.build())
.excludedPaths(SqlContainerIndexingPolicyExcludedPathArgs.builder()
.path("/excluded/?")
.build())
.build())
.uniqueKeys(SqlContainerUniqueKeyArgs.builder()
.paths(
"/definition/idlong",
"/definition/idshort")
.build())
.build());
}
}
resources:
exampleSqlDatabase:
type: azure:cosmosdb:SqlDatabase
name: example
properties:
name: example-acsd
resourceGroupName: ${example.resourceGroupName}
accountName: ${example.name}
exampleSqlContainer:
type: azure:cosmosdb:SqlContainer
name: example
properties:
name: example-container
resourceGroupName: ${example.resourceGroupName}
accountName: ${example.name}
databaseName: ${exampleSqlDatabase.name}
partitionKeyPaths:
- /definition/id
partitionKeyVersion: 1
throughput: 400
indexingPolicy:
indexingMode: consistent
includedPaths:
- path: /*
- path: /included/?
excludedPaths:
- path: /excluded/?
uniqueKeys:
- paths:
- /definition/idlong
- /definition/idshort
variables:
example:
fn::invoke:
function: azure:cosmosdb:getAccount
arguments:
name: tfex-cosmosdb-account
resourceGroupName: tfex-cosmosdb-account-rg

Import

Cosmos SQL Containers can be imported using the resource id, e.g.

$ pulumi import azure:cosmosdb/sqlContainer:SqlContainer example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DocumentDB/databaseAccounts/account1/sqlDatabases/database1/containers/container1

Constructors

Link copied to clipboard
constructor(accountName: Output<String>? = null, analyticalStorageTtl: Output<Int>? = null, autoscaleSettings: Output<SqlContainerAutoscaleSettingsArgs>? = null, conflictResolutionPolicy: Output<SqlContainerConflictResolutionPolicyArgs>? = null, databaseName: Output<String>? = null, defaultTtl: Output<Int>? = null, indexingPolicy: Output<SqlContainerIndexingPolicyArgs>? = null, name: Output<String>? = null, partitionKeyKind: Output<String>? = null, partitionKeyPaths: Output<List<String>>? = null, partitionKeyVersion: Output<Int>? = null, resourceGroupName: Output<String>? = null, throughput: Output<Int>? = null, uniqueKeys: Output<List<SqlContainerUniqueKeyArgs>>? = null)

Properties

Link copied to clipboard
val accountName: Output<String>? = null

The name of the Cosmos DB Account to create the container within. Changing this forces a new resource to be created.

Link copied to clipboard
val analyticalStorageTtl: Output<Int>? = null

The default time to live of Analytical Storage for this SQL container. If present and the value is set to -1, it is equal to infinity, and items don’t expire by default. If present and the value is set to some number n – items will expire n seconds after their last modified time.

Link copied to clipboard

An autoscale_settings block as defined below. This must be set upon database creation otherwise it cannot be updated without a manual destroy-apply.

Link copied to clipboard

A conflict_resolution_policy blocks as defined below. Changing this forces a new resource to be created.

Link copied to clipboard
val databaseName: Output<String>? = null

The name of the Cosmos DB SQL Database to create the container within. Changing this forces a new resource to be created.

Link copied to clipboard
val defaultTtl: Output<Int>? = null

The default time to live of SQL container. If missing, items are not expired automatically. If present and the value is set to -1, it is equal to infinity, and items don’t expire by default. If present and the value is set to some number n – items will expire n seconds after their last modified time.

Link copied to clipboard

An indexing_policy block as defined below.

Link copied to clipboard
val name: Output<String>? = null

Specifies the name of the Cosmos DB SQL Container. Changing this forces a new resource to be created.

Link copied to clipboard
val partitionKeyKind: Output<String>? = null

Define a partition key kind. Possible values are Hash and MultiHash. Defaults to Hash. Changing this forces a new resource to be created.

Link copied to clipboard
val partitionKeyPaths: Output<List<String>>? = null

A list of partition key paths. Changing this forces a new resource to be created.

Link copied to clipboard
val partitionKeyVersion: Output<Int>? = null

Define a partition key version. Possible values are 1and 2. This should be set to 2 in order to use large partition keys.

Link copied to clipboard
val resourceGroupName: Output<String>? = null

The name of the resource group in which the Cosmos DB SQL Container is created. Changing this forces a new resource to be created.

Link copied to clipboard
val throughput: Output<Int>? = null

The throughput of SQL container (RU/s). Must be set in increments of 100. The minimum value is 400. This must be set upon container creation otherwise it cannot be updated without a manual resource destroy-apply.

Link copied to clipboard

One or more unique_key blocks as defined below. Changing this forces a new resource to be created. //////

Functions

Link copied to clipboard
open override fun toJava(): SqlContainerArgs