Account Args
data class AccountArgs(val accessKeyMetadataWritesEnabled: Output<Boolean>? = null, val analyticalStorage: Output<AccountAnalyticalStorageArgs>? = null, val analyticalStorageEnabled: Output<Boolean>? = null, val automaticFailoverEnabled: Output<Boolean>? = null, val backup: Output<AccountBackupArgs>? = null, val burstCapacityEnabled: Output<Boolean>? = null, val capabilities: Output<List<AccountCapabilityArgs>>? = null, val capacity: Output<AccountCapacityArgs>? = null, val consistencyPolicy: Output<AccountConsistencyPolicyArgs>? = null, val corsRule: Output<AccountCorsRuleArgs>? = null, val createMode: Output<String>? = null, val defaultIdentityType: Output<String>? = null, val freeTierEnabled: Output<Boolean>? = null, val geoLocations: Output<List<AccountGeoLocationArgs>>? = null, val identity: Output<AccountIdentityArgs>? = null, val ipRangeFilters: Output<List<String>>? = null, val isVirtualNetworkFilterEnabled: Output<Boolean>? = null, val keyVaultKeyId: Output<String>? = null, val kind: Output<String>? = null, val localAuthenticationDisabled: Output<Boolean>? = null, val location: Output<String>? = null, val managedHsmKeyId: Output<String>? = null, val minimalTlsVersion: Output<String>? = null, val mongoServerVersion: Output<String>? = null, val multipleWriteLocationsEnabled: Output<Boolean>? = null, val name: Output<String>? = null, val networkAclBypassForAzureServices: Output<Boolean>? = null, val networkAclBypassIds: Output<List<String>>? = null, val offerType: Output<String>? = null, val partitionMergeEnabled: Output<Boolean>? = null, val publicNetworkAccessEnabled: Output<Boolean>? = null, val resourceGroupName: Output<String>? = null, val restore: Output<AccountRestoreArgs>? = null, val tags: Output<Map<String, String>>? = null, val virtualNetworkRules: Output<List<AccountVirtualNetworkRuleArgs>>? = null) : ConvertibleToJava<AccountArgs>
Manages a CosmosDB (formally DocumentDB) Account.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
import * as random from "@pulumi/random";
const rg = new azure.core.ResourceGroup("rg", {
name: "sample-rg",
location: "westus",
});
const ri = new random.RandomInteger("ri", {
min: 10000,
max: 99999,
});
const db = new azure.cosmosdb.Account("db", {
name: pulumi.interpolate`tfex-cosmos-db-${ri.result}`,
location: example.location,
resourceGroupName: example.name,
offerType: "Standard",
kind: "MongoDB",
automaticFailoverEnabled: true,
capabilities: [
{
name: "EnableAggregationPipeline",
},
{
name: "mongoEnableDocLevelTTL",
},
{
name: "MongoDBv3.4",
},
{
name: "EnableMongo",
},
],
consistencyPolicy: {
consistencyLevel: "BoundedStaleness",
maxIntervalInSeconds: 300,
maxStalenessPrefix: 100000,
},
geoLocations: [
{
location: "eastus",
failoverPriority: 1,
},
{
location: "westus",
failoverPriority: 0,
},
],
});
Content copied to clipboard
import pulumi
import pulumi_azure as azure
import pulumi_random as random
rg = azure.core.ResourceGroup("rg",
name="sample-rg",
location="westus")
ri = random.RandomInteger("ri",
min=10000,
max=99999)
db = azure.cosmosdb.Account("db",
name=ri.result.apply(lambda result: f"tfex-cosmos-db-{result}"),
location=example["location"],
resource_group_name=example["name"],
offer_type="Standard",
kind="MongoDB",
automatic_failover_enabled=True,
capabilities=[
{
"name": "EnableAggregationPipeline",
},
{
"name": "mongoEnableDocLevelTTL",
},
{
"name": "MongoDBv3.4",
},
{
"name": "EnableMongo",
},
],
consistency_policy={
"consistency_level": "BoundedStaleness",
"max_interval_in_seconds": 300,
"max_staleness_prefix": 100000,
},
geo_locations=[
{
"location": "eastus",
"failover_priority": 1,
},
{
"location": "westus",
"failover_priority": 0,
},
])
Content copied to clipboard
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
using Random = Pulumi.Random;
return await Deployment.RunAsync(() =>
{
var rg = new Azure.Core.ResourceGroup("rg", new()
{
Name = "sample-rg",
Location = "westus",
});
var ri = new Random.RandomInteger("ri", new()
{
Min = 10000,
Max = 99999,
});
var db = new Azure.CosmosDB.Account("db", new()
{
Name = ri.Result.Apply(result => $"tfex-cosmos-db-{result}"),
Location = example.Location,
ResourceGroupName = example.Name,
OfferType = "Standard",
Kind = "MongoDB",
AutomaticFailoverEnabled = true,
Capabilities = new[]
{
new Azure.CosmosDB.Inputs.AccountCapabilityArgs
{
Name = "EnableAggregationPipeline",
},
new Azure.CosmosDB.Inputs.AccountCapabilityArgs
{
Name = "mongoEnableDocLevelTTL",
},
new Azure.CosmosDB.Inputs.AccountCapabilityArgs
{
Name = "MongoDBv3.4",
},
new Azure.CosmosDB.Inputs.AccountCapabilityArgs
{
Name = "EnableMongo",
},
},
ConsistencyPolicy = new Azure.CosmosDB.Inputs.AccountConsistencyPolicyArgs
{
ConsistencyLevel = "BoundedStaleness",
MaxIntervalInSeconds = 300,
MaxStalenessPrefix = 100000,
},
GeoLocations = new[]
{
new Azure.CosmosDB.Inputs.AccountGeoLocationArgs
{
Location = "eastus",
FailoverPriority = 1,
},
new Azure.CosmosDB.Inputs.AccountGeoLocationArgs
{
Location = "westus",
FailoverPriority = 0,
},
},
});
});
Content copied to clipboard
package main
import (
"fmt"
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/cosmosdb"
"github.com/pulumi/pulumi-random/sdk/v4/go/random"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := core.NewResourceGroup(ctx, "rg", &core.ResourceGroupArgs{
Name: pulumi.String("sample-rg"),
Location: pulumi.String("westus"),
})
if err != nil {
return err
}
ri, err := random.NewRandomInteger(ctx, "ri", &random.RandomIntegerArgs{
Min: pulumi.Int(10000),
Max: pulumi.Int(99999),
})
if err != nil {
return err
}
_, err = cosmosdb.NewAccount(ctx, "db", &cosmosdb.AccountArgs{
Name: ri.Result.ApplyT(func(result int) (string, error) {
return fmt.Sprintf("tfex-cosmos-db-%v", result), nil
}).(pulumi.StringOutput),
Location: pulumi.Any(example.Location),
ResourceGroupName: pulumi.Any(example.Name),
OfferType: pulumi.String("Standard"),
Kind: pulumi.String("MongoDB"),
AutomaticFailoverEnabled: pulumi.Bool(true),
Capabilities: cosmosdb.AccountCapabilityArray{
&cosmosdb.AccountCapabilityArgs{
Name: pulumi.String("EnableAggregationPipeline"),
},
&cosmosdb.AccountCapabilityArgs{
Name: pulumi.String("mongoEnableDocLevelTTL"),
},
&cosmosdb.AccountCapabilityArgs{
Name: pulumi.String("MongoDBv3.4"),
},
&cosmosdb.AccountCapabilityArgs{
Name: pulumi.String("EnableMongo"),
},
},
ConsistencyPolicy: &cosmosdb.AccountConsistencyPolicyArgs{
ConsistencyLevel: pulumi.String("BoundedStaleness"),
MaxIntervalInSeconds: pulumi.Int(300),
MaxStalenessPrefix: pulumi.Int(100000),
},
GeoLocations: cosmosdb.AccountGeoLocationArray{
&cosmosdb.AccountGeoLocationArgs{
Location: pulumi.String("eastus"),
FailoverPriority: pulumi.Int(1),
},
&cosmosdb.AccountGeoLocationArgs{
Location: pulumi.String("westus"),
FailoverPriority: pulumi.Int(0),
},
},
})
if err != nil {
return err
}
return nil
})
}
Content copied to clipboard
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.random.RandomInteger;
import com.pulumi.random.RandomIntegerArgs;
import com.pulumi.azure.cosmosdb.Account;
import com.pulumi.azure.cosmosdb.AccountArgs;
import com.pulumi.azure.cosmosdb.inputs.AccountCapabilityArgs;
import com.pulumi.azure.cosmosdb.inputs.AccountConsistencyPolicyArgs;
import com.pulumi.azure.cosmosdb.inputs.AccountGeoLocationArgs;
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 rg = new ResourceGroup("rg", ResourceGroupArgs.builder()
.name("sample-rg")
.location("westus")
.build());
var ri = new RandomInteger("ri", RandomIntegerArgs.builder()
.min(10000)
.max(99999)
.build());
var db = new Account("db", AccountArgs.builder()
.name(ri.result().applyValue(_result -> String.format("tfex-cosmos-db-%s", _result)))
.location(example.location())
.resourceGroupName(example.name())
.offerType("Standard")
.kind("MongoDB")
.automaticFailoverEnabled(true)
.capabilities(
AccountCapabilityArgs.builder()
.name("EnableAggregationPipeline")
.build(),
AccountCapabilityArgs.builder()
.name("mongoEnableDocLevelTTL")
.build(),
AccountCapabilityArgs.builder()
.name("MongoDBv3.4")
.build(),
AccountCapabilityArgs.builder()
.name("EnableMongo")
.build())
.consistencyPolicy(AccountConsistencyPolicyArgs.builder()
.consistencyLevel("BoundedStaleness")
.maxIntervalInSeconds(300)
.maxStalenessPrefix(100000)
.build())
.geoLocations(
AccountGeoLocationArgs.builder()
.location("eastus")
.failoverPriority(1)
.build(),
AccountGeoLocationArgs.builder()
.location("westus")
.failoverPriority(0)
.build())
.build());
}
}
Content copied to clipboard
resources:
rg:
type: azure:core:ResourceGroup
properties:
name: sample-rg
location: westus
ri:
type: random:RandomInteger
properties:
min: 10000
max: 99999
db:
type: azure:cosmosdb:Account
properties:
name: tfex-cosmos-db-${ri.result}
location: ${example.location}
resourceGroupName: ${example.name}
offerType: Standard
kind: MongoDB
automaticFailoverEnabled: true
capabilities:
- name: EnableAggregationPipeline
- name: mongoEnableDocLevelTTL
- name: MongoDBv3.4
- name: EnableMongo
consistencyPolicy:
consistencyLevel: BoundedStaleness
maxIntervalInSeconds: 300
maxStalenessPrefix: 100000
geoLocations:
- location: eastus
failoverPriority: 1
- location: westus
failoverPriority: 0
Content copied to clipboard
User Assigned Identity Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
import * as std from "@pulumi/std";
const example = new azure.authorization.UserAssignedIdentity("example", {
resourceGroupName: exampleAzurermResourceGroup.name,
location: exampleAzurermResourceGroup.location,
name: "example-resource",
});
const exampleAccount = new azure.cosmosdb.Account("example", {
name: "example-resource",
location: exampleAzurermResourceGroup.location,
resourceGroupName: exampleAzurermResourceGroup.name,
defaultIdentityType: std.joinOutput({
separator: "=",
input: [
"UserAssignedIdentity",
example.id,
],
}).apply(invoke => invoke.result),
offerType: "Standard",
kind: "MongoDB",
capabilities: [{
name: "EnableMongo",
}],
consistencyPolicy: {
consistencyLevel: "Strong",
},
geoLocations: [{
location: "westus",
failoverPriority: 0,
}],
identity: {
type: "UserAssigned",
identityIds: [example.id],
},
});
Content copied to clipboard
import pulumi
import pulumi_azure as azure
import pulumi_std as std
example = azure.authorization.UserAssignedIdentity("example",
resource_group_name=example_azurerm_resource_group["name"],
location=example_azurerm_resource_group["location"],
name="example-resource")
example_account = azure.cosmosdb.Account("example",
name="example-resource",
location=example_azurerm_resource_group["location"],
resource_group_name=example_azurerm_resource_group["name"],
default_identity_type=std.join_output(separator="=",
input=[
"UserAssignedIdentity",
example.id,
]).apply(lambda invoke: invoke.result),
offer_type="Standard",
kind="MongoDB",
capabilities=[{
"name": "EnableMongo",
}],
consistency_policy={
"consistency_level": "Strong",
},
geo_locations=[{
"location": "westus",
"failover_priority": 0,
}],
identity={
"type": "UserAssigned",
"identity_ids": [example.id],
})
Content copied to clipboard
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
using Std = Pulumi.Std;
return await Deployment.RunAsync(() =>
{
var example = new Azure.Authorization.UserAssignedIdentity("example", new()
{
ResourceGroupName = exampleAzurermResourceGroup.Name,
Location = exampleAzurermResourceGroup.Location,
Name = "example-resource",
});
var exampleAccount = new Azure.CosmosDB.Account("example", new()
{
Name = "example-resource",
Location = exampleAzurermResourceGroup.Location,
ResourceGroupName = exampleAzurermResourceGroup.Name,
DefaultIdentityType = Std.Join.Invoke(new()
{
Separator = "=",
Input = new[]
{
"UserAssignedIdentity",
example.Id,
},
}).Apply(invoke => invoke.Result),
OfferType = "Standard",
Kind = "MongoDB",
Capabilities = new[]
{
new Azure.CosmosDB.Inputs.AccountCapabilityArgs
{
Name = "EnableMongo",
},
},
ConsistencyPolicy = new Azure.CosmosDB.Inputs.AccountConsistencyPolicyArgs
{
ConsistencyLevel = "Strong",
},
GeoLocations = new[]
{
new Azure.CosmosDB.Inputs.AccountGeoLocationArgs
{
Location = "westus",
FailoverPriority = 0,
},
},
Identity = new Azure.CosmosDB.Inputs.AccountIdentityArgs
{
Type = "UserAssigned",
IdentityIds = new[]
{
example.Id,
},
},
});
});
Content copied to clipboard
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/authorization"
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/cosmosdb"
"github.com/pulumi/pulumi-std/sdk/go/std"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := authorization.NewUserAssignedIdentity(ctx, "example", &authorization.UserAssignedIdentityArgs{
ResourceGroupName: pulumi.Any(exampleAzurermResourceGroup.Name),
Location: pulumi.Any(exampleAzurermResourceGroup.Location),
Name: pulumi.String("example-resource"),
})
if err != nil {
return err
}
_, err = cosmosdb.NewAccount(ctx, "example", &cosmosdb.AccountArgs{
Name: pulumi.String("example-resource"),
Location: pulumi.Any(exampleAzurermResourceGroup.Location),
ResourceGroupName: pulumi.Any(exampleAzurermResourceGroup.Name),
DefaultIdentityType: pulumi.String(std.JoinOutput(ctx, std.JoinOutputArgs{
Separator: pulumi.String("="),
Input: pulumi.StringArray{
pulumi.String("UserAssignedIdentity"),
example.ID(),
},
}, nil).ApplyT(func(invoke std.JoinResult) (*string, error) {
return invoke.Result, nil
}).(pulumi.StringPtrOutput)),
OfferType: pulumi.String("Standard"),
Kind: pulumi.String("MongoDB"),
Capabilities: cosmosdb.AccountCapabilityArray{
&cosmosdb.AccountCapabilityArgs{
Name: pulumi.String("EnableMongo"),
},
},
ConsistencyPolicy: &cosmosdb.AccountConsistencyPolicyArgs{
ConsistencyLevel: pulumi.String("Strong"),
},
GeoLocations: cosmosdb.AccountGeoLocationArray{
&cosmosdb.AccountGeoLocationArgs{
Location: pulumi.String("westus"),
FailoverPriority: pulumi.Int(0),
},
},
Identity: &cosmosdb.AccountIdentityArgs{
Type: pulumi.String("UserAssigned"),
IdentityIds: pulumi.StringArray{
example.ID(),
},
},
})
if err != nil {
return err
}
return nil
})
}
Content copied to clipboard
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.authorization.UserAssignedIdentity;
import com.pulumi.azure.authorization.UserAssignedIdentityArgs;
import com.pulumi.azure.cosmosdb.Account;
import com.pulumi.azure.cosmosdb.AccountArgs;
import com.pulumi.azure.cosmosdb.inputs.AccountCapabilityArgs;
import com.pulumi.azure.cosmosdb.inputs.AccountConsistencyPolicyArgs;
import com.pulumi.azure.cosmosdb.inputs.AccountGeoLocationArgs;
import com.pulumi.azure.cosmosdb.inputs.AccountIdentityArgs;
import com.pulumi.std.StdFunctions;
import com.pulumi.std.inputs.JoinArgs;
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 example = new UserAssignedIdentity("example", UserAssignedIdentityArgs.builder()
.resourceGroupName(exampleAzurermResourceGroup.name())
.location(exampleAzurermResourceGroup.location())
.name("example-resource")
.build());
var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
.name("example-resource")
.location(exampleAzurermResourceGroup.location())
.resourceGroupName(exampleAzurermResourceGroup.name())
.defaultIdentityType(StdFunctions.join(JoinArgs.builder()
.separator("=")
.input(
"UserAssignedIdentity",
example.id())
.build()).applyValue(_invoke -> _invoke.result()))
.offerType("Standard")
.kind("MongoDB")
.capabilities(AccountCapabilityArgs.builder()
.name("EnableMongo")
.build())
.consistencyPolicy(AccountConsistencyPolicyArgs.builder()
.consistencyLevel("Strong")
.build())
.geoLocations(AccountGeoLocationArgs.builder()
.location("westus")
.failoverPriority(0)
.build())
.identity(AccountIdentityArgs.builder()
.type("UserAssigned")
.identityIds(example.id())
.build())
.build());
}
}
Content copied to clipboard
resources:
example:
type: azure:authorization:UserAssignedIdentity
properties:
resourceGroupName: ${exampleAzurermResourceGroup.name}
location: ${exampleAzurermResourceGroup.location}
name: example-resource
exampleAccount:
type: azure:cosmosdb:Account
name: example
properties:
name: example-resource
location: ${exampleAzurermResourceGroup.location}
resourceGroupName: ${exampleAzurermResourceGroup.name}
defaultIdentityType:
fn::invoke:
function: std:join
arguments:
separator: =
input:
- UserAssignedIdentity
- ${example.id}
return: result
offerType: Standard
kind: MongoDB
capabilities:
- name: EnableMongo
consistencyPolicy:
consistencyLevel: Strong
geoLocations:
- location: westus
failoverPriority: 0
identity:
type: UserAssigned
identityIds:
- ${example.id}
Content copied to clipboard
Import
CosmosDB Accounts can be imported using the resource id
, e.g.
$ pulumi import azure:cosmosdb/account:Account account1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DocumentDB/databaseAccounts/account1
Content copied to clipboard
Constructors
Link copied to clipboard
constructor(accessKeyMetadataWritesEnabled: Output<Boolean>? = null, analyticalStorage: Output<AccountAnalyticalStorageArgs>? = null, analyticalStorageEnabled: Output<Boolean>? = null, automaticFailoverEnabled: Output<Boolean>? = null, backup: Output<AccountBackupArgs>? = null, burstCapacityEnabled: Output<Boolean>? = null, capabilities: Output<List<AccountCapabilityArgs>>? = null, capacity: Output<AccountCapacityArgs>? = null, consistencyPolicy: Output<AccountConsistencyPolicyArgs>? = null, corsRule: Output<AccountCorsRuleArgs>? = null, createMode: Output<String>? = null, defaultIdentityType: Output<String>? = null, freeTierEnabled: Output<Boolean>? = null, geoLocations: Output<List<AccountGeoLocationArgs>>? = null, identity: Output<AccountIdentityArgs>? = null, ipRangeFilters: Output<List<String>>? = null, isVirtualNetworkFilterEnabled: Output<Boolean>? = null, keyVaultKeyId: Output<String>? = null, kind: Output<String>? = null, localAuthenticationDisabled: Output<Boolean>? = null, location: Output<String>? = null, managedHsmKeyId: Output<String>? = null, minimalTlsVersion: Output<String>? = null, mongoServerVersion: Output<String>? = null, multipleWriteLocationsEnabled: Output<Boolean>? = null, name: Output<String>? = null, networkAclBypassForAzureServices: Output<Boolean>? = null, networkAclBypassIds: Output<List<String>>? = null, offerType: Output<String>? = null, partitionMergeEnabled: Output<Boolean>? = null, publicNetworkAccessEnabled: Output<Boolean>? = null, resourceGroupName: Output<String>? = null, restore: Output<AccountRestoreArgs>? = null, tags: Output<Map<String, String>>? = null, virtualNetworkRules: Output<List<AccountVirtualNetworkRuleArgs>>? = null)
Properties
Link copied to clipboard
Link copied to clipboard
An analytical_storage
block as defined below.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
A capacity
block as defined below.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
The creation mode for the CosmosDB Account. Possible values are Default
and Restore
. Changing this forces a new resource to be created.
Link copied to clipboard
The default identity for accessing Key Vault. Possible values are FirstPartyIdentity
, SystemAssignedIdentity
or UserAssignedIdentity
. Defaults to FirstPartyIdentity
.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Specifies the minimal TLS version for the CosmosDB account. Possible values are: Tls
, Tls11
, and Tls12
. Defaults to Tls12
.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
The name of the resource group in which the CosmosDB Account is created. Changing this forces a new resource to be created.
Link copied to clipboard
Link copied to clipboard