From the course: Learning Terraform

Unlock the full course today

Join today to access over 24,000 courses taught by industry experts.

Understanding Terraform errors

Understanding Terraform errors - Terraform Tutorial

From the course: Learning Terraform

Understanding Terraform errors

- [Instructor] Since we've been working with Starter Code, we haven't yet had a chance to see how Terraform responds to errors. So let's make some changes to our code to generate some errors. From the code repository, open up main.tf. And for this one, we can just use the Simple Editor. Right now our AWS instance is named web. Well, let's say that this web server is actually hosting a blog. So we'll go in and change its name here to blog. Then let's scroll down to the bottom and click Commit Changes. And you want it to say Commit directly to the main branch. Just a note, this is only changing the name used to reference the instance in Terraform and AWS. The instance name won't affect the actual host name of the machine. Now if we go back to Terraform Cloud, we can see that our latest run has happened already and there's a big red box that says Error. So let's click on that. Now at the top here, it says Plan errored, and there's two big errors, Error: Reference to undeclared resource…

Contents