Skip to content
forked from hashicorp/go-tfe

Terraform Enterprise API Client / SDK in Golang

License

Notifications You must be signed in to change notification settings

munriver98/go-tfe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terraform Enterprise Go Client

This is an API client for Terraform Enterprise.

Build Status GitHub license GoDoc Go Report Card GitHub issues

NOTE

The Terraform Enterprise API endpoints are in beta and are subject to change! So that means this API client is also in beta and is also subject to change. We will indicate any breaking changes by releasing new versions. Until the release of v1.0, any minor version changes will indicate possible breaking changes. Patch version changes will be used for both bugfixes and non-breaking changes.

Coverage

Currently the following endpoints are supported:

Installation

go get -u github.com/hashicorp/go-tfe

Usage

import tfe "github.com/hashicorp/go-tfe"

Construct a new TFE client, then use the various endpoints on the client to access different parts of the Terraform Enterprise API. For example, to list all organizations:

config := &tfe.Config{
	Token: "UXsybZKSz07IEw.tfev2.FajRykbzcnG9ESrhBjBMLNUSsPp69qLyzclIskE",
}

client, err := tfe.NewClient(config)
if err != nil {
	log.Fatal(err)
}

orgs, err := client.Organizations.List(OrganizationListOptions{})
if err != nil {
	log.Fatal(err)
}

Examples

The examples directory contains a couple of examples. One of which is listed here as well:

package main

import (
	"log"

	tfe "github.com/hashicorp/go-tfe"
)

func main() {
	config := &tfe.Config{
		Token: "UXsybZKSz07IEw.tfev2.FajRykbzcnG9ESrhBjBMLNUSsPp69qLyzclIskE",
	}

	client, err := tfe.NewClient(config)
	if err != nil {
		log.Fatal(err)
	}

	// Create a new organization
	options := tfe.OrganizationCreateOptions{
		Name:  tfe.String("example"),
		Email: tfe.String("[email protected]"),
	}
	org, err := client.Organizations.Create(options)
	if err != nil {
		log.Fatal(err)
	}

	// Delete an organization
	err = client.Organizations.Delete(org.Name)
	if err != nil {
		log.Fatal(err)
	}
}

For complete usage of the API client, see the full package docs.

About

Terraform Enterprise API Client / SDK in Golang

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%