The Azure CosmosDB Plugin integrates RightScale Self-Service with the basic functionality of the Azure CosmosDB Account API.
- A general understanding CAT development and definitions
- Refer to the guide documentation for details SS Guides
- The
admin
,ss_designer
&ss_end_user
roles, in a RightScale account with SelfService enabled.admin
is needed to retrieved the RightScale Credential values identified below. - Azure Service Principal (AKA Azure Active Directory Application) with the appropriate permissions to manage resources in the target subscription
- The following RightScale Credentials
AZURE_APPLICATION_ID
AZURE_APPLICATION_KEY
- The following packages are also required (See the Installation section for details):
- Be sure your RightScale account has Self-Service enabled
- Connect AzureRM Cloud credentials to your RightScale account (if not already completed)
- Follow steps to Create an Azure Active Directory Application
- Grant the Azure AD Application access to the necessary subscription(s)
- Retrieve the Application ID & Authentication Key
- Create RightScale Credentials with values that match the Application ID (Credential name:
AZURE_APPLICATION_ID
) & Authentication Key (Credential name:AZURE_APPLICATION_KEY
) - Retrieve your Tenant ID
- Update
azure_cosmosdb_plugin.rb
Plugin with your Tenant ID.- Replace "TENANT_ID" in
token_url "https://login.microsoftonline.com/TENANT_ID/oauth2/token"
with your Tenant ID
- Replace "TENANT_ID" in
- Navigate to the appropriate Self-Service portal
- For more details on using the portal review the SS User Interface Guide
- In the Design section, use the
Upload CAT
interface to complete the following:- Upload each of packages listed in the Requirements Section
- Upload the
azure_cosmosdb_plugin.rb
file located in this repository
The Azure CosmosDB Plugin has been packaged as plugins/rs_azure_cosmosdb
. In order to use this plugin you must import this plugin into a CAT.
import "plugins/rs_azure_cosmosdb"
For more information on using packages, please refer to the RightScale online documentation. Importing a Package
Azure CosmosDB resources can now be created by specifying a resource declaration with the desired fields. See the Supported Actions section for a full list of supported actions. The resulting resource can be manipulated just like the native RightScale resources in RCL and CAT. See the Examples Section for more examples and complete CAT's.
- db_account
resource "cosmosdb", type: "rs_azure_cosmosdb.db_account" do
name join(["cosmosdb-",last(split(@@deployment.href, "/"))])
resource_group @rg.name
location "central us"
kind "GlobalDocumentDB"
properties do {
"databaseAccountOfferType" => "Standard",
"locations" => [
{
"failoverPriority" => "0",
"locationName" => "west us"
},
{
"failoverPriority" => "1",
"locationName" => "east us"
},
],
"consistencyPolicy" => {
"defaultConsistencyLevel" => "Session",
"maxIntervalInSeconds" => "5",
"maxStalenessPrefix" => "100"
}
} end
tags do {
"defaultExperience" => "DocumentDB",
"cost_center" => "12345",
"environment" => "dev",
"department" => "engineering"
} end
end
Field Name | Required? | Description |
---|---|---|
name | Yes | The name of the CosmosDB Account in the specified subscription and resource group. |
resource_group | Yes | The name of the resource group. |
location | Yes | Datacenter to launch in |
kind | Yes | Indicates the type of database account. This can only be set at database account creation. |
properties | Yes | Properties of the CosmosDB Account object |
tags | No | Tag values |
Action | API Implementation | Support Level |
---|---|---|
create & update | Create Or Update | Supported |
destroy | Delete | Supported |
get & show | Get | Supported |
- id
- name
- location
- tags
- properties
- type
- kind
- provisioningState
- ipRangeFilter
- isVirtualNetworkFilterEnabled
- databaseAccountOfferType
- consistencyPolicy
- writeLocations
- readLocations
- failoverPolicies
- virtualNetworkRules
- The Azure CosmosDB Plugin makes no attempt to support non-Azure resources. (i.e. Allow the passing the RightScale or other resources as arguments to a CosmosDB resource.)
Full list of possible actions can be found on the Azure CosmosDB Documentation
Please review cosmosdb_test_cat.rb for a basic example implementation.
- Currently only supports Database Account resources due to API endpoint challenge with Database resources
The Azure CosmosDB Plugin source code is subject to the MIT license, see the LICENSE file.