https://github.com/praveen1664/translate-terra-form-resources-into-python-classes
This is the repository for transforming terra-form releases into python classes
https://github.com/praveen1664/translate-terra-form-resources-into-python-classes
cloud devops infrastructure-as-code python terraform
Last synced: about 2 months ago
JSON representation
This is the repository for transforming terra-form releases into python classes
- Host: GitHub
- URL: https://github.com/praveen1664/translate-terra-form-resources-into-python-classes
- Owner: praveen1664
- Created: 2018-02-22T02:51:50.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-05-25T10:09:54.000Z (almost 6 years ago)
- Last Synced: 2025-01-21T21:45:19.587Z (4 months ago)
- Topics: cloud, devops, infrastructure-as-code, python, terraform
- Language: Python
- Homepage:
- Size: 6.84 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Translate-Terra-form-resources-into-Python-Classes
# terra-py
# terra-py
Translate terraform resources into python classesExample:
Python```
➜ terra-py git:(master) ✗ python
Python 2.7.10 (default, Jul 14 2015, 19:46:27)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import json
>>> import tf_plan
>>>
>>> args = {'region':'us-west-1', 'name':'isa-nat', 'subnetId':'subnet-12345678', 'keyName':'isa_keypair'}
>>>
>>> nat = tf_plan.tfNatInstance(args)
>>>
>>> print nat.id
${aws_instance.isa-nat.id}
>>>
>>> print json.dumps(nat.terraform, indent=2)
{
"isa-nat": {
"ami": "ami-004b0f60",
"instance_type": "t2.micro",
"provider": "aws.us-west-1",
"subnet_id": "subnet-12345678",
"key_name": "isa_keypair",
"tags": {
"Name": "isa-nat"
},
"associate_public_ip_address": true
}
}
>>>
```