From the course: Learning Terraform

Unlock the full course today

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

Modularize

Modularize

- [Instructor] We've just about got a module, but there are a couple of things left. First, it would be nice to have some output. So, let's look in main.tf and see if there's anything obvious here. There's not a whole lot we'll want to output, since most of this we're specifying. But for our ALB, it might be useful to see the DNS entry, so that we can go to that webpage. Let's open up the Terraform Registry and we'll browse modules here. Let's find our ALB. Here we go. Now, if we look down to this section, you see there's inputs and outputs. So, let's take a look at the output and see if we can find our DNS entry. Here we go, lb_dns_name. So, back in our code, we can open outputs and say output. Let's call it environment_url. And we can just set the value equal to module.blog_alb.lb_dns_name. Of course you can add more using the same pattern, but this should be enough for this small module. Okay, now we should have everything we need to create our module. Now, all we really have to do…

Contents