No commit activity in last 3 years
No release in over 3 years
Ruby client that supports all of the Terraform Enterprise API methods.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 2.0.2, ~> 2.0
 Project Readme

Terraform Enterprise API Client

A simple Ruby API client library for the Terraform Enterprise API.

Gem Version Maintainability Test Coverage Inline docs

NOTE: The command line tool has moved to skierkowski/terraform-enterprise-cli.

Requirements

MRI Ruby 2.3 and newer are supported. Alternative interpreters compatible with 2.3+ should work as well.

This gem depends on these other gems for usage at runtime:

API Client

Usage

Basic Example

require 'terraform-enterprise-client'

token = ENV['TFE_TOKEN']
client = TerraformEnterprise::API::Client.new(token: token)

# Create a new organization
org = client.organizations.create(name:'my-org',email:'maciej@skierkowski.com')

# Create a new workspace in the new organization.
# Uses the same parameters as the following docs:
# https://www.terraform.io/docs/enterprise/api/workspaces.html
client.workspaces.create(name:'my-new-workspace', organization:'my-org')

# Delete the workspace
client.workspaces.delete(name:'my-new-workspace', organization: 'my-org')

# Delete the organization now that we are done
client.organizations.delete(name:'my-org')

Configuration

There are two main settings that can be modified on initialization:

  • :token (required) - which specifies the API key (formerly called ATLAS_TOKEN)
  • :host - a hostname other than the default (app.terraform.io) for usage with private installs