The official Go API client for Terraform Cloud/Enterprise.
This client supports the Terraform Cloud V2 API. As Terraform Enterprise is a self-hosted distribution of Terraform Cloud, this client supports both Cloud and Enterprise use cases. In all package documentation and API, the platform will always be stated as 'Terraform Enterprise' - but a feature will be explicitly noted as only supported in one or the other, if applicable (rare).
Almost always, minor version changes will indicate backwards-compatible features and enhancements. Occasionally, function signature changes that reflect a bug fix may appear as a minor version change. Patch version changes will be used for bug fixes, performance improvements, and otherwise unimpactful changes.
Installation can be done with a normal go get
:
go get -u github.com/hashicorp/go-tfe
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(), nil)
if err != nil {
log.Fatal(err)
}
For complete usage of the API client, see the full package docs.
This API client covers most of the existing Terraform Cloud API calls and is updated regularly to add new or missing endpoints.
- Account
- Agents
- Agent Pools
- Agent Tokens
- Applies
- Audit Trails
- Changelog
- Comments
- Configuration Versions
- Cost Estimation
- Feature Sets
- Invoices
- IP Ranges
- Notification Configurations
- OAuth Clients
- OAuth Tokens
- Organizations
- Organization Memberships
- Organization Tags
- Organization Tokens
- Plan Exports
- Plans
- Policies
- Policy Checks
- Policy Sets
- Policy Set Parameters
- Private Registry
- Modules
- Providers
- Provider Provider Versions and Platforms
- GPG Keys
- Runs
- Run Tasks
- Run Tasks Integration
- Run Triggers
- SSH Keys
- Stability Policy
- State Versions
- State Version Outputs
- Subscriptions
- Team Access
- Team Membership
- Team Tokens
- Teams
- User Tokens
- Users
- Variable Sets
- Variables
- VCS Events
- Workspaces
- Workspace-Specific Variables
- Workspace Resources
- Admin
- Module Sharing
- Organizations
- Runs
- Settings
- Terraform Versions
- Users
- Workspaces
See the examples directory.
See TESTS.md.
See CONTRIBUTING.md
See RELEASES.md