Skip to content

Latest commit

 

History

History

rs_azure_cosmosdb

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Azure CosmosDB Plugin

Overview

The Azure CosmosDB Plugin integrates RightScale Self-Service with the basic functionality of the Azure CosmosDB Account API.

Requirements

  • 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):

Installation

  1. Be sure your RightScale account has Self-Service enabled
  2. Connect AzureRM Cloud credentials to your RightScale account (if not already completed)
  3. Follow steps to Create an Azure Active Directory Application
  4. Grant the Azure AD Application access to the necessary subscription(s)
  5. Retrieve the Application ID & Authentication Key
  6. Create RightScale Credentials with values that match the Application ID (Credential name: AZURE_APPLICATION_ID) & Authentication Key (Credential name: AZURE_APPLICATION_KEY)
  7. Retrieve your Tenant ID
  8. 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
  9. Navigate to the appropriate Self-Service portal
  10. In the Design section, use the Upload CAT interface to complete the following:
    1. Upload each of packages listed in the Requirements Section
    2. Upload the azure_cosmosdb_plugin.rb file located in this repository

How to Use

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.

Supported Resources

  • db_account

Usage

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

Resources

vaults

Supported Fields

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

Supported Actions

Action API Implementation Support Level
create & update Create Or Update Supported
destroy Delete Supported
get & show Get Supported

Supported Outputs

  • id
  • name
  • location
  • tags
  • properties
  • type
  • kind
  • provisioningState
  • ipRangeFilter
  • isVirtualNetworkFilterEnabled
  • databaseAccountOfferType
  • consistencyPolicy
  • writeLocations
  • readLocations
  • failoverPolicies
  • virtualNetworkRules

Implementation Notes

  • 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

Examples

Please review cosmosdb_test_cat.rb for a basic example implementation.

Known Issues / Limitations

  • Currently only supports Database Account resources due to API endpoint challenge with Database resources

License

The Azure CosmosDB Plugin source code is subject to the MIT license, see the LICENSE file.