Skip to content

Instantly share code, notes, and snippets.

View gitrgoliveira's full-sized avatar
💭
I may be slow to respond.

Ricardo Oliveira gitrgoliveira

💭
I may be slow to respond.
View GitHub Profile
import os
from terrasnek.api import TFC as TFP
# do `pip install terrasnek` before running this script
TFE_TOKEN = os.getenv("TFE_TOKEN", None)
TFE_URL = os.getenv("TFE_URL", "https://app.terraform.io") # ex: https://app.terraform.io
api = TFP(TFE_TOKEN, url=TFE_URL)
orgs = api.orgs.list()['data']
#! /usr/bin/env python3
# Retrieve workspace resource counts and output sorted list (most resources first)
# NB: skeleton code ... only checks for basic errors in responses
# Reads inputs from env vars or interactively
import argparse
from getpass import getpass
import os
import requests
import threading