adjust readme

This commit is contained in:
jerger 2022-08-19 15:50:09 +02:00
parent 441bc497d1
commit bc27522fb5

View file

@ -1,21 +1,15 @@
## Introduction ## Introduction
python-terraform is a python module provide a wrapper of `terraform` command line tool. dda-python-terraform is a python module provide a wrapper of `terraform` command line tool.
`terraform` is a tool made by Hashicorp, please refer to https://terraform.io/ `terraform` is a tool made by Hashicorp, please refer to https://terraform.io/
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
### Status
[![Build Status](https://travis-ci.org/aubustou/python-terraform.svg?branch=develop)](https://travis-ci.org/aubustou/python-terraform)
## Installation ## Installation
pip install python-terraform pip install python-terraform
## Usage ## Usage
#### For any terraform command #### For any terraform command
from python_terraform import * from dda_python_terraform import *
t = Terraform() t = Terraform()
return_code, stdout, stderr = t.<cmd_name>(*arguments, **options) return_code, stdout, stderr = t.<cmd_name>(*arguments, **options)
@ -23,13 +17,13 @@ python-terraform is a python module provide a wrapper of `terraform` command lin
to be able to call the method, you could call cmd_name by adding `_cmd` after command name, for example, to be able to call the method, you could call cmd_name by adding `_cmd` after command name, for example,
`import` here could be called by `import` here could be called by
from python_terraform import * from dda_python_terraform import *
t = Terraform() t = Terraform()
return_code, stdout, stderr = t.import_cmd(*arguments, **options) return_code, stdout, stderr = t.import_cmd(*arguments, **options)
or just call cmd method directly or just call cmd method directly
from python_terraform import * from dda_python_terraform import *
t = Terraform() t = Terraform()
return_code, stdout, stderr = t.cmd(<cmd_name>, *arguments, **options) return_code, stdout, stderr = t.cmd(<cmd_name>, *arguments, **options)
@ -82,7 +76,7 @@ simply pass the string to arguments of the method, for example,
By default, stdout and stderr are captured and returned. This causes the application to appear to hang. To print terraform output in real time, provide the `capture_output` option with any value other than `None`. This will cause the output of terraform to be printed to the terminal in real time. The value of `stdout` and `stderr` below will be `None`. By default, stdout and stderr are captured and returned. This causes the application to appear to hang. To print terraform output in real time, provide the `capture_output` option with any value other than `None`. This will cause the output of terraform to be printed to the terminal in real time. The value of `stdout` and `stderr` below will be `None`.
from python_terraform import Terraform from dda_python_terraform import Terraform
t = Terraform() t = Terraform()
return_code, stdout, stderr = t.<cmd_name>(capture_output=False) return_code, stdout, stderr = t.<cmd_name>(capture_output=False)
@ -96,19 +90,19 @@ In shell:
In python-terraform: In python-terraform:
from python_terraform import * from dda_python_terraform import *
tf = Terraform(working_dir='/home/test') tf = Terraform(working_dir='/home/test')
tf.apply(no_color=IsFlagged, refresh=False, var={'a':'b', 'c':'d'}) tf.apply(no_color=IsFlagged, refresh=False, var={'a':'b', 'c':'d'})
or or
from python_terraform import * from dda_python_terraform import *
tf = Terraform() tf = Terraform()
tf.apply('/home/test', no_color=IsFlagged, refresh=False, var={'a':'b', 'c':'d'}) tf.apply('/home/test', no_color=IsFlagged, refresh=False, var={'a':'b', 'c':'d'})
or or
from python_terraform import * from dda_python_terraform import *
tf = Terraform(working_dir='/home/test', variables={'a':'b', 'c':'d'}) tf = Terraform(working_dir='/home/test', variables={'a':'b', 'c':'d'})
tf.apply(no_color=IsFlagged, refresh=False) tf.apply(no_color=IsFlagged, refresh=False)
@ -120,7 +114,7 @@ In shell:
In python-terraform: In python-terraform:
from python_terraform import * from dda_python_terraform import *
tf = terraform(working_dir='/home/test') tf = terraform(working_dir='/home/test')
tf.fmt(diff=True) tf.fmt(diff=True)