SqlDatabase
Manages a SQL Database within a Cosmos DB Account.
Example Usage
using Pulumi;
using Azure = Pulumi.Azure;
class MyStack : Stack
{
public MyStack()
{
var exampleAccount = Output.Create(Azure.CosmosDB.GetAccount.InvokeAsync(new Azure.CosmosDB.GetAccountArgs
{
Name = "tfex-cosmosdb-account",
ResourceGroupName = "tfex-cosmosdb-account-rg",
}));
var exampleSqlDatabase = new Azure.CosmosDB.SqlDatabase("exampleSqlDatabase", new Azure.CosmosDB.SqlDatabaseArgs
{
ResourceGroupName = exampleAccount.Apply(exampleAccount => exampleAccount.ResourceGroupName),
AccountName = exampleAccount.Apply(exampleAccount => exampleAccount.Name),
Throughput = 400,
});
}
}
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v3/go/azure/cosmosdb"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleAccount, err := cosmosdb.LookupAccount(ctx, &cosmosdb.LookupAccountArgs{
Name: "tfex-cosmosdb-account",
ResourceGroupName: "tfex-cosmosdb-account-rg",
}, nil)
if err != nil {
return err
}
_, err = cosmosdb.NewSqlDatabase(ctx, "exampleSqlDatabase", &cosmosdb.SqlDatabaseArgs{
ResourceGroupName: pulumi.String(exampleAccount.ResourceGroupName),
AccountName: pulumi.String(exampleAccount.Name),
Throughput: pulumi.Int(400),
})
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_azure as azure
example_account = azure.cosmosdb.get_account(name="tfex-cosmosdb-account",
resource_group_name="tfex-cosmosdb-account-rg")
example_sql_database = azure.cosmosdb.SqlDatabase("exampleSqlDatabase",
resource_group_name=example_account.resource_group_name,
account_name=example_account.name,
throughput=400)import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const exampleAccount = azure.cosmosdb.getAccount({
name: "tfex-cosmosdb-account",
resourceGroupName: "tfex-cosmosdb-account-rg",
});
const exampleSqlDatabase = new azure.cosmosdb.SqlDatabase("exampleSqlDatabase", {
resourceGroupName: exampleAccount.then(exampleAccount => exampleAccount.resourceGroupName),
accountName: exampleAccount.then(exampleAccount => exampleAccount.name),
throughput: 400,
});Create a SqlDatabase Resource
new SqlDatabase(name: string, args: SqlDatabaseArgs, opts?: CustomResourceOptions);def SqlDatabase(resource_name, opts=None, account_name=None, name=None, resource_group_name=None, throughput=None, __props__=None);func NewSqlDatabase(ctx *Context, name string, args SqlDatabaseArgs, opts ...ResourceOption) (*SqlDatabase, error)public SqlDatabase(string name, SqlDatabaseArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args SqlDatabaseArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args SqlDatabaseArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args SqlDatabaseArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
SqlDatabase Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The SqlDatabase resource accepts the following input properties:
- Account
Name string The name of the Cosmos DB SQL Database to create the table within. Changing this forces a new resource to be created.
- Resource
Group stringName The name of the resource group in which the Cosmos DB SQL Database is created. Changing this forces a new resource to be created.
- Name string
Specifies the name of the Cosmos DB SQL Database. Changing this forces a new resource to be created.
- Throughput int
The throughput of SQL database (RU/s). Must be set in increments of
100. The minimum value is400. This must be set upon database creation otherwise it cannot be updated without a manual resource destroy-apply.
- Account
Name string The name of the Cosmos DB SQL Database to create the table within. Changing this forces a new resource to be created.
- Resource
Group stringName The name of the resource group in which the Cosmos DB SQL Database is created. Changing this forces a new resource to be created.
- Name string
Specifies the name of the Cosmos DB SQL Database. Changing this forces a new resource to be created.
- Throughput int
The throughput of SQL database (RU/s). Must be set in increments of
100. The minimum value is400. This must be set upon database creation otherwise it cannot be updated without a manual resource destroy-apply.
- account
Name string The name of the Cosmos DB SQL Database to create the table within. Changing this forces a new resource to be created.
- resource
Group stringName The name of the resource group in which the Cosmos DB SQL Database is created. Changing this forces a new resource to be created.
- name string
Specifies the name of the Cosmos DB SQL Database. Changing this forces a new resource to be created.
- throughput number
The throughput of SQL database (RU/s). Must be set in increments of
100. The minimum value is400. This must be set upon database creation otherwise it cannot be updated without a manual resource destroy-apply.
- account_
name str The name of the Cosmos DB SQL Database to create the table within. Changing this forces a new resource to be created.
- resource_
group_ strname The name of the resource group in which the Cosmos DB SQL Database is created. Changing this forces a new resource to be created.
- name str
Specifies the name of the Cosmos DB SQL Database. Changing this forces a new resource to be created.
- throughput float
The throughput of SQL database (RU/s). Must be set in increments of
100. The minimum value is400. This must be set upon database creation otherwise it cannot be updated without a manual resource destroy-apply.
Outputs
All input properties are implicitly available as output properties. Additionally, the SqlDatabase resource produces the following output properties:
Look up an Existing SqlDatabase Resource
Get an existing SqlDatabase 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?: SqlDatabaseState, opts?: CustomResourceOptions): SqlDatabasestatic get(resource_name, id, opts=None, account_name=None, name=None, resource_group_name=None, throughput=None, __props__=None);func GetSqlDatabase(ctx *Context, name string, id IDInput, state *SqlDatabaseState, opts ...ResourceOption) (*SqlDatabase, error)public static SqlDatabase Get(string name, Input<string> id, SqlDatabaseState? state, CustomResourceOptions? opts = null)- 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.
The following state arguments are supported:
- Account
Name string The name of the Cosmos DB SQL Database to create the table within. Changing this forces a new resource to be created.
- Name string
Specifies the name of the Cosmos DB SQL Database. Changing this forces a new resource to be created.
- Resource
Group stringName The name of the resource group in which the Cosmos DB SQL Database is created. Changing this forces a new resource to be created.
- Throughput int
The throughput of SQL database (RU/s). Must be set in increments of
100. The minimum value is400. This must be set upon database creation otherwise it cannot be updated without a manual resource destroy-apply.
- Account
Name string The name of the Cosmos DB SQL Database to create the table within. Changing this forces a new resource to be created.
- Name string
Specifies the name of the Cosmos DB SQL Database. Changing this forces a new resource to be created.
- Resource
Group stringName The name of the resource group in which the Cosmos DB SQL Database is created. Changing this forces a new resource to be created.
- Throughput int
The throughput of SQL database (RU/s). Must be set in increments of
100. The minimum value is400. This must be set upon database creation otherwise it cannot be updated without a manual resource destroy-apply.
- account
Name string The name of the Cosmos DB SQL Database to create the table within. Changing this forces a new resource to be created.
- name string
Specifies the name of the Cosmos DB SQL Database. Changing this forces a new resource to be created.
- resource
Group stringName The name of the resource group in which the Cosmos DB SQL Database is created. Changing this forces a new resource to be created.
- throughput number
The throughput of SQL database (RU/s). Must be set in increments of
100. The minimum value is400. This must be set upon database creation otherwise it cannot be updated without a manual resource destroy-apply.
- account_
name str The name of the Cosmos DB SQL Database to create the table within. Changing this forces a new resource to be created.
- name str
Specifies the name of the Cosmos DB SQL Database. Changing this forces a new resource to be created.
- resource_
group_ strname The name of the resource group in which the Cosmos DB SQL Database is created. Changing this forces a new resource to be created.
- throughput float
The throughput of SQL database (RU/s). Must be set in increments of
100. The minimum value is400. This must be set upon database creation otherwise it cannot be updated without a manual resource destroy-apply.
Package Details
- Repository
- https://github.com/pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
azurermTerraform Provider.