Sometimes you need your infrastructure to be a bit more dynamic and flexible. Learn how to use variables in your code and on the command line.
- [Instructor] We haven't gone too deep … into variables in Terraform so far. … I've been hoping we could cover a good foundation … of resources before we talk about them. … Here's some code for how you might define a variable … for the ami of an instance or asg resource. … This example also defines a default, … so you'll always have a base version there. … We can then use that variable … like this in the instance config. … Using variables can be a handy way of organizing your code … by keeping together anything you might change often. … Like the ami id or the white listed ip addresses … in your security group. … You can override that default value on the command line … by passing in the dash-var parameter. … Here we might say, Terraform apply -var webserver_ami equals … and that's an ami. … This can be pretty handy for learning and for q/a type uses. … But it really feels like a fairly manual process, … not really in the spirit of Terraform. … Let's take a look at data sources now … which are like variables …
- Setting up Terraform
- How Terraform works
- Core Terraform commands
- Leveraging style conventions to keep code readable
- Configuring security groups
- Adding load balancers
- Using variables in your code
Skill Level Beginner
1. First Steps with Terraform
2. Terraform in Action
3. Infrastructure as Code
4. Advanced Topics
Next steps3m 31s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.