Open ismail44 opened 5 years ago
This worked for me
approve = {"auto-approve": True}
x = (tf.apply( skip_plan=True,**approve))
Hi,
I have used the below script and trying to execute terraform script but the terraform apply does not work
from python_terraform import * tf = Terraform(working_dir='/home/ubuntu/Amrutha/pshell') tf.plan(no_color=IsFlagged, refresh=False, capture_output=True) approve = {"auto-approve": True} print(tf.plan()) print(tf.apply(**approve))
Could you please let me know if iam missing put anything, as my required is to execute terraform apply with auto approve.
whats the output?
@amruthapbhat auto-approve won't work that way. You need to pass skip_plan=True to set auto-approve True. I'm not sure if this is the intended behaviour, but in the code, auto-approve is overwritten after it's passed based on skip_plan being True or False. @beelit94 Maybe you could answer this.
Using TF 0.11.10.
terraform apply -no-color -input=false -auto-approve=false /tmp/tmpurzm0_cx
When running this apply, terraform ran without prompting the user for
yes
. I suspect it's a change in the way that Terraform reads in the -auto-approve flag. According to the Terraform documentation,-auto-approve
does not take any values, it's just a flag. I'm thinking that regardless of the value, Terraform is seeing the flag and applying auto-approve.