https://github.com/awslabs/tecli

In a world where everything is Terraform, teams use Terraform Cloud API to manage their workloads. TECLI increases teams productivity by facilitating such interaction and by providing easy commands that can be executed on a terminal or on CI/CD systems.

https://github.com/awslabs/tecli

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.5%) to scientific vocabulary

Keywords

amazon-web-services command-line continuous-delivery continuous-integration devops terraform terraform-cloud
Last synced: 6 months ago · JSON representation

Repository

In a world where everything is Terraform, teams use Terraform Cloud API to manage their workloads. TECLI increases teams productivity by facilitating such interaction and by providing easy commands that can be executed on a terminal or on CI/CD systems.

Basic Info
Statistics
  • Stars: 213
  • Watchers: 11
  • Forks: 20
  • Open Issues: 5
  • Releases: 7
Topics
amazon-web-services command-line continuous-delivery continuous-integration devops terraform terraform-cloud
Created about 5 years ago · Last pushed 9 months ago
Metadata Files
Readme Changelog Contributing License Code of conduct

README.md

TECLI - Terraform Enterprise/Cloud Command Line Interface

![TECLI Logo](clencli/logo.jpeg) [![GitHub issues](https://img.shields.io/github/issues/awslabs/tecli)](https://github.com/awslabs/tecli/issues) [![GitHub forks](https://img.shields.io/github/forks/awslabs/tecli)](https://github.com/awslabs/tecli/network) [![GitHub stars](https://img.shields.io/github/stars/awslabs/tecli)](https://github.com/awslabs/tecli/stargazers) [![GitHub license](https://img.shields.io/github/license/awslabs/tecli)](https://github.com/awslabs/tecli/blob/master/LICENSE) [![Twitter](https://img.shields.io/twitter/url?style=social&url=https%3A%2F%2Fgithub.com%2Fawslabs%2Ftecli)](https://twitter.com/intent/tweet?text=Wow:&url=https%3A%2F%2Fgithub.com%2Fawslabs%2Ftecli)

📖 Overview

TECLI is a powerful command-line interface designed to interact with Terraform Cloud API. It enhances team productivity by providing intuitive commands that can be executed in a terminal or integrated into CI/CD pipelines.

In a world where infrastructure as code is becoming the standard, TECLI bridges the gap between your workflows and Terraform Cloud, making it easier to manage workspaces, runs, variables, and more.

🚀 Features

  • Workspace Management: Create, read, update, delete, and list Terraform workspaces
  • Run Operations: Create, apply, and discard Terraform runs
  • Plan & Apply Management: View logs for plan and apply operations
  • Variable Management: Create, update, and delete Terraform and environment variables
  • VCS Integration: Connect workspaces to version control repositories
  • SSH Key Management: Manage SSH keys for private module access
  • OAuth Client Management: Configure OAuth clients for VCS providers

📋 Table of Contents

📥 Installation

Prerequisites

Before installing TECLI, ensure you have:

  • A Terraform Cloud/Enterprise account
  • Appropriate API tokens (user, team, or organization)

For more detailed prerequisites, visit our Pre-Requisites Wiki.

Installation Steps

  1. Download the latest release for your operating system and platform.
  2. Extract the binary to a location in your PATH.
  3. Verify the installation:

bash tecli version

For more detailed installation instructions, visit our Installation Wiki.

⚙️ Configuration

TECLI requires configuration before use. You can configure it in two ways:

Using the Configure Command

bash tecli configure create

This interactive command will guide you through setting up your profile with: - Organization name - User token - Team token - Organization token

Using Environment Variables

```bash

Linux/macOS

export TFCORGANIZATION=your-organization export TFCUSERTOKEN=your-user-token export TFCTEAMTOKEN=your-team-token export TFCORGANIZATION_TOKEN=your-organization-token

Windows (PowerShell)

$Env:TFCORGANIZATION="your-organization" $Env:TFCUSERTOKEN="your-user-token" $Env:TFCTEAMTOKEN="your-team-token" $Env:TFCORGANIZATION_TOKEN="your-organization-token" ```

🔍 Usage Examples

Basic Command Structure

bash tecli <resource> <action> [flags]

List All Workspaces

bash tecli workspace list --organization=your-organization

Find a Workspace by Name

bash tecli workspace find-by-name --organization=your-organization --name=your-workspace-name

Create a Workspace

bash tecli workspace create --organization=your-organization --name=your-workspace-name --allow-destroy-plan=true

Create a Workspace with VCS Repository

```bash

First, get the OAuth Token ID

tecli o-auth-token list --organization=your-organization

Then create the workspace with VCS connection

tecli workspace create \ --organization=your-organization \ --name=your-workspace-name \ --vcs-repo-oauth-token-id=your-oauth-token-id \ --vcs-repo-identifier=org/repo ```

Create and Apply a Run

```bash

Create a configuration version

tecli configuration-version create --workspace-id=your-workspace-id

Upload configuration files

tecli configuration-version upload --url=your-upload-url --path=./

Create a run

tecli run create --workspace-id=your-workspace-id --comment="Your comment"

Check run status

tecli run read --id=your-run-id

Apply the run

tecli run apply --id=your-run-id --comment="Apply comment" ```

Manage Variables

```bash

Create a sensitive Terraform variable

tecli variable create \ --key=your-variable-key \ --value=your-variable-value \ --workspace-id=your-workspace-id \ --category=terraform \ --sensitive=true

Create AWS environment variables

tecli variable create --key=AWSACCESSKEYID --value=your-access-key --workspace-id=your-workspace-id --category=env --sensitive=true tecli variable create --key=AWSSECRETACCESSKEY --value=your-secret-key --workspace-id=your-workspace-id --category=env --sensitive=true tecli variable create --key=AWSDEFAULTREGION --value=your-region --workspace-id=your-workspace-id --category=env --sensitive=true ```

📚 Command Reference

TECLI provides the following main commands:

Available Commands: apply An apply represents the results of applying a Terraform Run's execution plan. configuration-version A configuration version is a resource used to reference the uploaded configuration files. configure Configures tecli settings help Help about any command o-auth-client An OAuth Client represents the connection between an organization and a VCS provider. o-auth-token The oauth-token object represents a VCS configuration which includes the OAuth connection and the associated OAuth token. plan A plan represents the execution plan of a Run in a Terraform workspace. run A run performs a plan and apply, using a configuration version and the workspace's current variables. ssh-key The ssh-key object represents an SSH key which includes a name and the SSH private key. variable Operations on variables. version Displays the version of tecli and all installed plugins workspace Workspaces represent running infrastructure managed by Terraform.

For detailed information about a specific command:

bash tecli [command] --help

🔄 Common Workflows

Complete Terraform Run Workflow

```bash

Create a workspace

tecli workspace create --organization=your-org --name=your-workspace

Create a configuration version

tecli configuration-version create --workspace-id=your-workspace-id

Upload configuration files

tecli configuration-version upload --url=your-upload-url --path=./

Create a run

tecli run create --workspace-id=your-workspace-id --comment="Initial run"

Monitor run status

tecli run read --id=your-run-id

View plan logs

tecli plan logs --id=your-plan-id

Apply the run

tecli run apply --id=your-run-id --comment="Applying changes"

View apply logs

tecli apply logs --id=your-apply-id ```

Monitoring and Waiting for Run Completion

```bash

Bash script to wait for run completion

while true; do STATUS=$(tecli run read --id=your-run-id | jq -r ".Status") if [ "${STATUS}" != "pending" ]; then break else echo "RUN STATUS:${STATUS}, IF 'pending' TRY DISCARD PREVIOUS PLANS. SLEEP 5 seconds" && sleep 5 fi done ```

📸 Screenshots

Click to expand screenshots | ![How to configure](clencli/terminalizer/configure.gif) | | :-----------------------------------------------------: | | _How to configure_ | | ![How to create a workspace](clencli/terminalizer/workspace-create.gif) | | :---------------------------------------------------------------------: | | _How to create a workspace_ | | ![How to create a workspace linked to a repository](clencli/terminalizer/workspace-with-vcs-repo.gif) | | :---------------------------------------------------------------------------------------------------: | | _How to create a workspace linked to a repository_ | | ![How to create a run](clencli/terminalizer/run-create.gif) | | :---------------------------------------------------------: | | _How to create a run_ | | ![How to read plan logs](clencli/terminalizer/plan-logs.gif) | | :----------------------------------------------------------: | | _How to read plan logs_ | | ![How to read apply logs](clencli/terminalizer/apply-logs.gif) | | :------------------------------------------------------------: | | _How to read apply logs_ | | ![How to delete a workspace](clencli/terminalizer/workspace-delete.gif) | | :---------------------------------------------------------------------: | | _How to delete a workspace_ |

👥 Contributing

We welcome contributions to TECLI! Please read our Contributing Guidelines for details on how to submit pull requests, report issues, and suggest improvements.

Contributors

| Name | Email | Role | | :--: | :---: | :--: | | Silva, Valter | valterh@amazon.com | AWS Professional Services - Cloud Architect | | Dhingra, Prashit | | AWS Professional Services - Cloud Architect |

🔗 References

📄 License

This project is licensed under the Apache License 2.0. For more information, please read LICENSE.


Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

Photo by Gabriel Menchaca on Unsplash

Owner

  • Name: Amazon Web Services - Labs
  • Login: awslabs
  • Kind: organization
  • Location: Seattle, WA

AWS Labs

GitHub Events

Total
  • Release event: 2
  • Watch event: 2
  • Push event: 1
  • Pull request event: 3
  • Fork event: 2
  • Create event: 2
Last Year
  • Release event: 2
  • Watch event: 2
  • Push event: 1
  • Pull request event: 3
  • Fork event: 2
  • Create event: 2

Committers

Last synced: 12 months ago

All Time
  • Total Commits: 194
  • Total Committers: 3
  • Avg Commits per committer: 64.667
  • Development Distribution Score (DDS): 0.01
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Valter Silva v****h@a****m 192
Jordan Liggitt l****t@g****m 1
Prashit Dhingra a****h@a****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 12 months ago

All Time
  • Total issues: 6
  • Total pull requests: 13
  • Average time to close issues: 2 months
  • Average time to close pull requests: 2 months
  • Total issue authors: 6
  • Total pull request authors: 3
  • Average comments per issue: 1.17
  • Average comments per pull request: 0.23
  • Merged pull requests: 9
  • Bot issues: 0
  • Bot pull requests: 4
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • darkn3rd (1)
  • simonavril (1)
  • Rosalind-Fletcher (1)
  • uturunku1 (1)
  • robinbowes (1)
  • mavogel (1)
Pull Request Authors
  • valter-silva-au (8)
  • dependabot[bot] (7)
  • liggitt (1)
Top Labels
Issue Labels
enhancement (2)
Pull Request Labels
dependencies (7) go (3) enhancement (2)

Packages

  • Total packages: 1
  • Total downloads: unknown
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 3
proxy.golang.org: github.com/awslabs/tecli

Copyright © 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

  • Versions: 3
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Stargazers count: 2.1%
Forks count: 3.1%
Average: 5.4%
Dependent packages count: 7.0%
Dependent repos count: 9.3%
Last synced: 6 months ago

Dependencies

go.mod go
  • github.com/hashicorp/go-retryablehttp v0.6.8
  • github.com/hashicorp/go-slug v0.6.0
  • github.com/hashicorp/go-tfe v0.15.0
  • github.com/magiconair/properties v1.8.1
  • github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e
  • github.com/sirupsen/logrus v1.2.0
  • github.com/spf13/afero v1.3.4
  • github.com/spf13/cobra v1.0.0
  • github.com/spf13/pflag v1.0.5
  • github.com/spf13/viper v1.4.0
  • github.com/stretchr/testify v1.6.1
  • golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de
  • golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1
  • golang.org/x/time v0.0.0-20201208040808-7e3f01d25324
  • gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f
  • gopkg.in/yaml.v2 v2.2.8
  • gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776
go.sum go
  • 159 dependencies
.github/workflows/build.yml actions
  • actions/checkout v2 composite
  • actions/setup-go v2 composite
.github/workflows/release.yml actions
  • actions/checkout v2 composite
  • actions/create-release v1 composite
  • actions/setup-go v2 composite
  • actions/upload-release-asset v1 composite
.github/workflows/publish.yml actions
  • actions/checkout v2 composite
  • actions/create-release v1 composite
  • actions/setup-go v2 composite
  • actions/upload-release-asset v1 composite
.devcontainer/requirements.txt pypi
  • ansible * development
  • pre-commit * development