Skip to main content

A CLI tool to manage Terraform Components

Project description

Comet

Comet is a CLI to manage multiple Terraform configurations in parallel.

Features

  • Supports use of workspaces
  • Filter executions based on job name, region or workspace
  • Runs Terraform in parallel
  • DRY backend configuration
  • Maps workspaces to different accounts

Limitations

  • Cannot initialize new workspace
  • Need to run comet init anytime changes to Terraform files are made
  • Limited debug logging
  • Does NOT prompt user to approve apply or destroy
  • Only supports local Terraform configurations

Getting Started

pip install pycomet

comet --help

Usage: comet [OPTIONS] COMMAND [ARGS]...

  A program to manage and run multiple terraform configurations.

Options:
  -c, --config-file TEXT      Name of comet config file  [default: comet.yml]
  -d, --depends-on TEXT       Run all jobs that have a depency matching a
                              regex.
  --debug TEXT                Enable debug output.
  -j, --jobs TEXT             Filter jobs using a regular expression.
  -m, --max-parallel INTEGER  Maximum number of jobs to run in parallel
                              (cannot be more than number of cores).
  -r, --region TEXT           Filter regions using regex.
  -w, --workspace TEXT        Filter workspaces using regex.
  -v                          Enable debug logging
  --help                      Show this message and exit.

Commands:
  apply    Run terraform apply.
  destroy  Run terraform destroy.
  init     Run terraform init.
  plan     Run terraform plan.

Configuration

The following configuration is found in the examples directory:

---
workspaces:
    - name: prod
      account_id: 12345678
      regions:
          - us-east-1
          - us-west-2
    - name: staging
      account_id: 12345678
      regions:
          - us-west-2
    - name: default
      account_id: 12345678
      regions:
          - us-west-2


# TODO: Add support for creating provider and remote state
backend:
    bucket: cs-comet-test-state
    key: "{{job_name}}/{{region}}"
    region: "us-west-2"
    role_arn: "arn:aws:iam::{{account_id}}:role/terraform"

jobs:
  - name: app
    # TODO: Add ability to include other directories as dependencies
    source: app
    # Depends on can be any value you decide, it is a way to identify jobs have a common dependency. 
    # If you have a job that depends on an external module you can give it a name such as modules-null-label
    # running comet -d modules-null-label will trigger every job that has the value in it's depends on list.
    depends_on:
        - users
        - modules-null-label
  - name: users
    source: users
    depends_on:
        - app
  - name: website
    source: website
    depends_on:
        - modules-null-label

Workspaces

A list of workspaces used by your Terraform configurations. It is recommended to use a different AWS account for each workspace to isolate your environments.

Backend

Specifies backend parameters to be used during terraform init. Comet using pystache to render variable values from job and workspace configurations.

Jobs

Each job must specify a name and source. The field depends_on is used to to filter jobs based on dependencies. However, depends_on does not make a dependency graph between jobs. From our experience it is not often you want to run through an entire dependency graph of Terraform configurations, rather you want to run one set that depends on a common value.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pycomet-0.0.6.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pycomet-0.0.6-py2-none-any.whl (8.7 kB view details)

Uploaded Python 2

File details

Details for the file pycomet-0.0.6.tar.gz.

File metadata

  • Download URL: pycomet-0.0.6.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.15rc1

File hashes

Hashes for pycomet-0.0.6.tar.gz
Algorithm Hash digest
SHA256 b8175afece3c385ebcb622a180786e7eb4935c3b187b04a832197dc9dbcf986e
MD5 d32cec495dc5d6281caf749c69d9fc58
BLAKE2b-256 3e2994a7424f9b2276187a3f40c3b843af9be1ab33a49e6892fcc55defbbaf19

See more details on using hashes here.

File details

Details for the file pycomet-0.0.6-py2-none-any.whl.

File metadata

  • Download URL: pycomet-0.0.6-py2-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.15rc1

File hashes

Hashes for pycomet-0.0.6-py2-none-any.whl
Algorithm Hash digest
SHA256 ef42ea5cf0ade5eaca6d543f06bc4105191f7bead3542259295c5a57d7e34c89
MD5 b897ea7703d49ecb2836dc0cd7d29cab
BLAKE2b-256 06e2edfdcbedf8ddbb8a214051f3d2d615059c3a1ebf0c00ca54af8372173437

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page