Skip to main content

terragit

terragit is a Python package allow access to the GitLab server API , in order to perform terraform/git operations

precondition

install python-gitlab package: pip install python-gitlab

Installation

pip install terragit

Start-up

terragit config

before using any of the bellow commands you will need to run terragit config command to initialise terragit:
you will be asked to enter the following information :

gitlab_token : gitlab token allows you to access remotely to your gitlab account
keybase : terragit use keybase mainly to decrypt IAM credentials
gitlab_user : your gitlab username

after running terragit config successfully it will create a file called ./terragit in your home directory
after that you can run the commands bellow

terragit {switch}

.Allows you to switch between groups/project present in .terragit file and use the project/group information
when executing some terragit commands like terragit plan or apply in this case the command is going to use IAM account credentials
.Creates a ~/.terragit_profile file with corresponding environment variables {-g} {--group_id} : group/project id of the group/project that you want to switch to {-gn} {--group_name} : group/project name of the group/project that you want to switch to .Please run source ~/.terragit_profile when success .Add aws profiles to ~/.aws/credentials file (you should have aws-cli installed)

terragit {compare}

Allows you to compare two infrastructures by giving source and destination local tf states in json format.
.Creates terragit-compare folder, where you can see:\

State_list.csv file: comparison between 2 infrastructure different states
S_list{State_name}.csv: Detailed properties' comparison of each common state
{-I}: local path for source infra
{-N}: local path for destination infra

terragit {validate}

Allows you to validate a terraform module by giving the local path or project id and path of the target folder from content root \ {-p}: local path
{-P}: path of the target folder from content root in case of remote project
{-prId}: git/gitlab project id

terragit {plan|validate|changes|apply|output}

you must switch to a project before using this command if you intend to use it with AWS services
in order to get IAM credentials from .terragit file

{-d} {--destroy}: to indicate if it is destroy make plan a plan destroy and make apply a destroy
{-c} {--commit_id}: commit id
{-mrid} { --mr_id}: merge id
{-dir} {--directory}: directory
{-p} {--project_id}: project id
{-v} {-verbose}: to indicate if output will exit on the console and in log folder too\

terragit {docs}

{-p} {--project_id}: project id
{-m} {--module} : for docs module
{-l} {--live} : for live infra
{-o} {--output} : output path : default {"./"}\

terragit {clone}

Allows you to clone a project or the entire projects of a specific group(projects of subgroups included),
check if you have an aws account, and if you have one, this feature is going to decrypt your credentials
and add group information to .terragit file

{-g} {--group_id}: provide group id if you want to clone a group, if not, don't use this argument
{-p} {--project_id}: provide project id if you want to clone a project, if not, don't use this argument
{-ip} {--infra_project_id}: your infrastructure project id in case you are cloning a group to check if you have
{--path}: the path to clone the project in \

terragit {adduser}

Using this command, you can add a user to a gitlab group or project and create an AWS account for him.
first this command is going to check if a user exists or not in gitlab group or project.Then based
on the search result it will either add user to repository, create AWS account for the user or do both.

{-g} {--group_id}: provide group id if you want to add user to a group, if not, don't use this argument
{-p} {--project_id}: provide project id if you want to add user to a project, if not, don't use this argument
{-ip} {--gitlab_username}: gitlab username of the user you want to add
{-lvl} {--access_level} : access level of the user you want to add, possible values (guest, reporter, developer, maintainer or owner)\

terragit {clean}

Allows you to delete old merge requests, branches or both of a project or group. {-g} {--group_id}: provide group id if you want to clean a group. if not, don't use this argument
{-p} {--project_id}: provide project id if you want to clean a project. if not, don't use this argument
{-t} {--time}: provide time(number of days) to delete branches/merge-requests older then time provided
Example :if you provide 10 it will delete all branches/merge-requests older then 10 days.
provide 0 if you want to delete all branches/merge-requests
{-mr} {--mr}: set it to true if you want to delete Merge requests else false
{-b} {--branches}: set it to true if you want to delete branches else false \

terragit {list}

list projects/groups in .terragit file

terragit {currentProject}

get selected project/group (you can select project/group using terragit switch command)

terragit {status}

this command executes terragit status on all git projects inside a given directory

{-dir} {--directory}: directory\

terragit {project-list}

Allows you to list all groups in clients-acp group and clone the entire projects of a specific group

{-dir} {--directory}: directory where to make the clone \

Metadata

Release files for terragit 0.3.88

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for terragit 0.3.88
File Size Uploaded Provenance Actions
terragit-0.3.88.tar.gz 44.2 kB Without provenance Details for terragit-0.3.88.tar.gz

Release files / terragit-0.3.88.tar.gz

Download URL terragit-0.3.88.tar.gz
Size 44.2 kB
Tags Source
SHA-256 checksum
How to use checksums
04ab707db01cb161e7f76902631237aab20a61bd0fafff4ad410aff97ad1dc5f
BLAKE2b-256 checksum
How to use checksums
fdb5b93d06de27b6ba1b070b29fa07605eb0a4f2a2e2d8838b8118dd1187711c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.4.2 requests/2.20.0 setuptools/45.1.0 requests-toolbelt/0.8.0 tqdm/4.19.4 CPython/3.8.1

Security for terragit 0.3.88

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.88 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page