GitHub - mjuenema/python-terrascript: Create Terraform files
GitHub - mjuenema/python-terrascript: Create Terraform files using Python scripts.
Terrascript supports Python 3.6 and later.
Module layout
Python-Terrascript release 0.8.0 changed the location of modules.
Providers, resources and data sources are now all available through just
three modules.
import terrascript
import terrascript.provider # aws, google, .
import terrascript.resource # aws instance, google compute instance, .
import terrascript.data # aws ami, google compute image, .
The legacy layout is still available but should not be used for new projects.
import terrascript
import terrascript.aws # aws
import terrascript.aws.r # aws instance, .
import terrascript.aws.d # aws ami, .
A first example
The following example has been taken from the official Terraform documentation
for the AWS Provider and then converted into a Python script that generates