This repository enables locking and unlocking of terraform remote state file for AWS.
Pre Requisites:
Before running the 'terraform.py' ensure the following resources on your system.
- Latest terraform build
- AWS credentials are sources as environment variables:
export AWS_DEFAULT_REGION=
export AWS_ACCESS_KEY_ID=
export AWS_SECRET_ACCESS_KEY=
export S3_BUCKET_NAME=bucket-tfstate
export DB_DOMAIN_NAME=tfstate - Run 'pip install -r requirements.txt' (To install dependencies)
- The Terraform template file is in the same directory as the resository.
To run terraform.py:
python terraform.py
For terraform plan : python terraform.py plan
For terraform apply : python terraform.py deploy
For terraform destroy: python terraform.py destroy.
To use this file as a library:
import terraform
To call terraform run:
terraform.run_command('plan/apply/destroy')