Terraform Azure Importer is a small script to import existing Azure resources into Terraform's state when the resources were created outside of Terraform
Just clone this repository or download it.
pip3 install azure.mgmt.compute
pip3 install azure.identity
pip3 install chardetFirst you need to create a terraform plan in json:
terraform plan -out <plan_name>.tfplan
terraform show -json <plan_name>.tfplan > <plan_name>.jsonAfter creating the plan, just call the script passing the json plan:
python3 import.py --plan <plan_name>.json --subscription <your_subscription_id>Note: if you wish to execute the import automatically, you can use the parameter apply:
python3 import.py --plan <plan_name>.json --subscription <your_subscription_id> --applyPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
MIT