Error handling in terraform

1,049 views
Skip to first unread message

Mangalick Mitra

unread,
Mar 28, 2017, 8:49:39 AM3/28/17
to Terraform
Just started using terraform. Sometimes when using the apply command, the resources may not be created due to wrong image id, region etc etc. Can someone please tell me is there an error handling way for when an apply fails. Like if am using a script to execute the terraform commands, how do i know if the apply executed successfully. 

Lowe Schmidt

unread,
Mar 28, 2017, 9:22:05 AM3/28/17
to terrafo...@googlegroups.com
If you're running terraform from a *nix like operating system, you can look at the exit code. 
0 should be successful and everything else some sort of failure. 

For example:

 ~  tf apply
No configuration files found!
[...]
 ✘  ~  echo $?
1
 

--
Lowe Schmidt | +46 723 867 157

On 28 March 2017 at 14:49, Mangalick Mitra <mangal...@gmail.com> wrote:
Just started using terraform. Sometimes when using the apply command, the resources may not be created due to wrong image id, region etc etc. Can someone please tell me is there an error handling way for when an apply fails. Like if am using a script to execute the terraform commands, how do i know if the apply executed successfully. 

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/terraform/issues
IRC: #terraform-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Terraform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to terraform-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/52ebe537-8556-4304-b5b7-2fb2407322be%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages