Project

armrest

0.01
The project is in a healthy, maintained state
Ruby Azure REST API Library
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

Armrest

BoltOps Badge

Gem Version

A very lightweight Azure library that works with the Azure REST API, it is not meant to be exhaustive.

This was built because there doesn't seem to be a good library out there with the Azure features that Terraspace and Terraspace Plugin Azurerm wanted to use:

  • Auth Chain Provider: env vars -> MSI -> CLI creds. #6
  • KeyVault secrets via the REST API

Also, the Microsoft Azure SDK for Ruby library was deprecated as of Feb 2021 and was officially retired. It's core library ms_rest_azure.gemspec have pinned versions of gems like faraday < 2, which causes gem dependency resolution issues.

This library also only makes use of the Ruby standard builtin net/http library so there's no dependency on faraday.

Again, this library has no goals of being extensive. Code generated SDKs is the approach that would take for that, but not dedicating the time to do that for this library.

Usage: Ruby

Resource group:

require "armrest"
resource_group = Armrest::Services::ResourceGroup.new
resource_group.create_or_update(
  name: "my-resource-group",
  location: "eastus",
  tags: {key1: "value1"},
)

Refer to the boltops-tools/terraspace_plugin_azurerm for more examples.

Usage: CLI

The main purpose of gem is to be a Ruby library that Terraspace can interact with. The CLI interface was only built to help quickly test the code with live resources. It's essentially a way to QA. Here are some examples:

Auth:

armrest auth app
armrest auth msi
armrest auth cli

The auth chain is: app -> msi -> cli

armrest auth

You can disable MSI with ARMREST_DISABLE_MSI=1.

Resource Group:

armrest resource_group check_existence demo

Storage Account:

armrest storage_account create demofoobar123v3 --tags name:bob age:8

Blob Service:

armrest blob_service set_properties --storage-account demofoobar123 --delete-retention-policy days:9 enabled:true --container-delete-retention-policy days:10 enabled:true --is-versioning-enabled

Secret:

$ export ARMREST_VAULT=demo-dev-vault-test1
$ armrest secret show demo-dev-pass
secret1
$

Installation

Add to your Gemfile

Gemfile

gem "armrest"