В Python 3.7, работающем в Windows, какой специальный синтаксис требуется для:
1. Navigate to a directory containing a terraform program
2. Execute "terraform apply -auto-approve" in that target directory
3. Extract the resulting output variables into a form usable in python
Выходные переменные могут иметь вид:
security_group_id_nodes = sg-xxxxxxxxxx
vpc_id_myvpc = vpc-xxxxxxxxxxxxx
Хотите использовать стиль Windows cmdЗдесь команды, а не powershell.
Моя первая неудачная попытка новичка:
import os
os.chdir('C:\\path\\to\\terraform\\code')
from subprocess import check_output
check_output("terraform apply -auto-approve", shell=True).decode()