You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
terraform/vendor/github.com/hashicorp/go-tfe
Pam Selle a8dcd0cab2
go mod vendor; go mod tidy
7 years ago
..
LICENSE
README.md vendor latest go-tfe 7 years ago
apply.go depencies: update `go-tfe` 8 years ago
configuration_version.go vendor: github.com/hashicorp/go-tfe@v0.3.8 7 years ago
cost_estimate.go update to go-tfe 0.3.23 7 years ago
go.mod go mod vendor; go mod tidy 7 years ago
go.sum go mod vendor; go mod tidy 7 years ago
logreader.go depencies: update `go-tfe` 8 years ago
notification_configuration.go gomod: update `go-tfe` 7 years ago
oauth_client.go depencies: update `go-tfe` 8 years ago
oauth_token.go depencies: update `go-tfe` 8 years ago
organization.go update go-tfe to v0.3.16 7 years ago
organization_token.go depencies: update `go-tfe` 8 years ago
plan.go vendor latest go-tfe 7 years ago
plan_export.go vendor latest go-tfe 7 years ago
policy.go depencies: update `go-tfe` 8 years ago
policy_check.go go-mod: update dependencies 7 years ago
policy_set.go vendor latest go-tfe 7 years ago
run.go vendor latest go-tfe 7 years ago
ssh_key.go depencies: update `go-tfe` 8 years ago
state_version.go gomod: update `go-tfe` 7 years ago
team.go vendor: github.com/hashicorp/go-tfe@v0.3.8 7 years ago
team_access.go go-mod: update dependencies 7 years ago
team_member.go depencies: update `go-tfe` 8 years ago
team_token.go depencies: update `go-tfe` 8 years ago
tfe.go vendor latest go-tfe 7 years ago
type_helpers.go vendor latest go-tfe 7 years ago
user.go
validations.go
variable.go gomod: update `go-tfe` 7 years ago
workspace.go Point to tfignore branch of go-tfe 7 years ago

README.md

Terraform Enterprise Go Client

Build Status GitHub license GoDoc Go Report Card GitHub issues

This is an API client for Terraform Enterprise.

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

Installation can be done with a normal go get:

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

Documentation

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

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: "insert-your-token-here",
}

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

orgs, err := client.Organizations.List(context.Background(), 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: "insert-your-token-here",
	}

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

	// Create a context
	ctx := context.Background()

	// Create a new organization
	options := tfe.OrganizationCreateOptions{
		Name:  tfe.String("example"),
		Email: tfe.String("info@example.com"),
	}

	org, err := client.Organizations.Create(ctx, options)
	if err != nil {
		log.Fatal(err)
	}

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

Running tests

Tests are run against an actual backend so they require a valid backend address and token. In addition it also needs a Github token for running the OAuth Client tests:

$ export TFE_ADDRESS=https://tfe.local
$ export TFE_TOKEN=xxxxxxxxxxxxxxxxxxx
$ export GITHUB_TOKEN=xxxxxxxxxxxxxxxx
$ export GITHUB_IDENTIFIER=xxxxxxxxxxx

In order for the tests relating to queuing and capacity to pass, FRQ should be enabled with a limit of 2 concurrent runs per organization.

As running the tests takes about ~10 minutes, make sure to add a timeout to your command (as the default timeout is 10m):

$ go test ./... -timeout=15m

Issues and Contributing

If you find an issue with this package, please report an issue. If you'd like, we welcome any contributions. Fork this repository and submit a pull request.