Skip to main content

Terrajinja extension for automation using cdktf

Project description

Terrajinja CLI

Is a intermediate command line interface that accepts YAML/Jinja2 template files as input in order to generate a terraform deployment

CLI command structure

Each command is represented as a command or subcommand, and there are a number of command and subcommand options available:

$ tjcli <command> {deploy,template,init} [args]
  • init - creates the config directory structure
  • template - list or add templates to your config
  • deploy - create a deployment for your config

for additional help ad the --help parameter to the sub command e.g.:

$ tjcli template --help

Getting started

start by installing the cli using pip

$ pip install terrajinja-cli

next step is to choose a place to store your config, in general this is a git repository. you can then create the initial directory stucture in that directory

$ tjcli init
creating directory project/deployments
creating directory project/templates
creating directory project/parameters

to get some inspiration look at the available templates that have already been created for your inspiration.

$ tjcli template --list
available templates:
  gitlab-runner: for creating a gitlab runner on kubernetes

you can add any of these templates to your project

$ tjcli template --add gitlab-runner
requesting to add template {args.template}...
dest: project/templates/generic_gitlab_runner_v0.0.1.yaml
adding: templates / generic_gitlab_runner_v0.0.1.yaml
dest: project/parameters/gitlab_runner.yaml
adding: parameters / gitlab_runner.yaml

Configuring a deployment

Terra jinja expects the following paths to contain YAML or Jinja2 template files:

directory files description
parameters YAML only main input to be used by all deployments
deployments YAML/Jinja2 this defines the accepted parameters and what templates to execute
templates YAML/Jinja2 the templates define the terraform modules to execute

Please refer to the documentation for the full file specifications

Deploying your deployment

Which deployment is available depends on the files you created in the deployments directory e.g.:

$ tjcli deploy -d my_deployment -a mailrelay -e test

Note that the parameters are dynamicly based on the deployment file, so the actual parameters availabe will vary on your config.

Once terrajinja created your deployment you can run cdktf to apply or destroy your deployment. e.g.:

cdktf apply

History

0.0.1 (14-03-2024)

  • First code creation

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

terrajinja-cli-0.7.1.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

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

terrajinja_cli-0.7.1-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file terrajinja-cli-0.7.1.tar.gz.

File metadata

  • Download URL: terrajinja-cli-0.7.1.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.5

File hashes

Hashes for terrajinja-cli-0.7.1.tar.gz
Algorithm Hash digest
SHA256 ef8ffa7652281e53d7bfc8a38d94659fb41ebb344de75f8528e2bf1c9bac7fa7
MD5 2df68dfd4e534bb3476124e82aa115d4
BLAKE2b-256 54a8f5eb9b60ff039d4b76c4726ceac394b2b0b04065b72eb9963ee69007d651

See more details on using hashes here.

File details

Details for the file terrajinja_cli-0.7.1-py3-none-any.whl.

File metadata

  • Download URL: terrajinja_cli-0.7.1-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.5

File hashes

Hashes for terrajinja_cli-0.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d67b3d99e250d07c6bb04a344e10661459ed411047fbdfed0c6f232b4f71a5c4
MD5 9ba36ccd24e7e60b41049f41666122e1
BLAKE2b-256 d896d0dae3f9fae775208807cff9ca0bdff4294e749b1d2590863a80828842e7

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