Giter Club home page Giter Club logo

tfx's Introduction

TFx CLI

tfx is a standalone CLI for Terraform Cloud and Terraform Enterprise.

The initial focus of tfx was to execute the API-Driven workflow for a Workspace but has grown to manage multiple aspects of the platform.

Note: This CLI is still under active development, subject to change, and is not officially supported by HashiCorp.

main Go Version

Documentation

Questions about a Command? Check out the docs

Why does this CLI exist?

As a consumer of Terraform Cloud or Terraform Enterprise I want to leverage the full capabilities without having to write curl/python/(insert other) libraries to call the API.

Often times these tasks are part of a delivery pipeline, but could also be administrative tasks that are done from a local machine. The goal of this tool is to allow users to interact with the platform easily without having to create a lot of hard to maintain code.

Common API-Driven Workflow Challenges:

The initial use case for tfx was to bridge the gap from the CLI-Workflow and the API-Driven Workflow.

  • The CLI-Driven workflow presents several challenges when creating more advanced pipelines for a Workspace run, specifically the inability to insert a gate check between a plan and apply, (in other words you must run a terraform apply -auto-approve).
  • The CLI driven workflow requires a terraform init that forces a download of providers before a plan can be called remotely, these providers are never actually used on the local host and can be difficult to source airgapped environments.
  • Implementing an API-Driven workflow requires several API calls to perform a plan/apply.
  • It is unlikely that the full range of features will be built into Terraform.
  • Developing CI/CD specific plugins for even the most common tools is not feasible, and ignores the ability to run the commands locally.

Terminal Example Plan

Installation

Binaries are created as part of release, check out the Release Page for the latest release.

MacOs Installation

version="0.0.3-dev"
curl -L -o tfx "https://github.com/straubt1/tfx/releases/download/${version}/tfx_darwin_amd64"
chmod +x tfx

Linux Installation

version="0.0.3-dev"
curl -L -o tfx "https://github.com/straubt1/tfx/releases/download/${version}/tfx_linux_amd64"
chmod +x tfx

Windows Installation

version="0.0.3-dev"
curl -L -o tfx.exe "https://github.com/straubt1/tfx/releases/download/${version}/tfx_windows_amd64"

Go Installation From Go version 1.18, the following is supported. @latest can be @$VERSION

go install github.com/straubt1/tfx@latest

Usage

Each command has the ability to pass in parameters via flags, several are required for every command.

Example:

  --tfeHostname string       The hostname of TFE without the schema. Can also be set with the environment variable TFE_HOSTNAME. (default "app.terraform.io")
  --tfeOrganization string   The name of the TFx Organization. Can also be set with the environment variable TFE_ORGANIZATION.
  --tfeToken string          The API token used to authenticate to TFx. Can also be set with the environment variable TFE_TOKEN.

Flags can also be created in a configuration file with the file name ".tfx.hcl". Flags can also be set via environment values by using a key that is capitalized version of the flag.

For convenience this file will automatically load if it is in the hosts home directory or current working directory.

Example: ./.tfx.hcl

tfeHostname     = "tfe.rocks" (omit to default to Terraform Cloud)
tfeOrganization = "my-awesome-org"
tfeToken        = "<Generated from Terraform Enterprise or Terraform Cloud>"

You can also specify this file via the --config flag.

Contributing

Thank you for your interest in contributing!

Contributing guide coming soon

References

https://github.com/hashicorp/go-tfe

https://github.com/spf13/cobra#installing

https://mholt.github.io/json-to-go/

tfx's People

Contributors

abuxton avatar straubt1 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.