beelit94 / python-terraform

MIT License
475 stars 171 forks source link

Input variables wrong order - username, password #78

Closed giva01121 closed 4 years ago

giva01121 commented 4 years ago

Hello, I'm facing the following issue. I've set input=IsFlagged, no matter which terraform action I execute,I'm always prompted to input the the value for os_password and then for os_username. Here's my code:

   # ACTIONS  
   if action == "plan":
     if targetin != "":
       return_code, stdout, stderr = tf.plan(input=IsFlagged,capture_output=False,var={'default_sg_id':dflt_security_group,'lb_members':loadbalancers,'os_project_id':project_id})
     else:
       return_code, stdout, stderr = tf.plan(input=IsFlagged,target=targetin,capture_output=False,var={'default_sg_id':dflt_security_group,'lb_members':loadbalancers,'os_project_id':project_id})
   elif action == "destroy":
      if targetin != "":
       return_code, stdout, stderr = tf.destroy(input=IsFlagged,capture_output=False,var={'default_sg_id':dflt_security_group,'lb_members':loadbalancers,'os_project_id':project_id})
      else:
       return_code, stdout, stderr = tf.destroy(input=IsFlagged,target=targetin,capture_output=False,var={'default_sg_id':dflt_security_group,'lb_members':loadbalancers,'os_project_id':project_id})
   elif action == "apply":
     if targetin != "":
       return_code, stdout, stderr = tf.apply(input=IsFlagged,capture_output=False,var={'default_sg_id':dflt_security_group,'lb_members':loadbalancers,'os_project_id':project_id})
     else:
       return_code, stdout, stderr = tf.apply(input=IsFlagged,target=targetin,capture_output=False,var={'default_sg_id':dflt_security_group,'lb_members':loadbalancers,'os_project_id':project_id})
   else:
     exit

In all of my variable related files I've first declared the variable for username and under it the variable for password: 09 variable os_username {} 10 variable os_password {}

Do you know how to change the order, first get request for username and then for password input ?

Spikeophant commented 4 years ago

What happens if you run this with straight TF, do you get the same behavior?

giva01121 commented 4 years ago

well, it seems yes. Sorry, I thought that the issue was caused by the python module. Anyway do you have idea why it's happening ?