From the course: Learning Terraform

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Split out your data

Split out your data - Terraform Tutorial

From the course: Learning Terraform

Split out your data

We're about ready to convert our code into a module, but first we'll need to do some work to pull out the configuration values. The way I like to do this kind of thing is to start by duplicating my entire code file into the variables file. That saves a lot of back and forth with copy and paste. To get started, just open main.tf in your Git repo, and select everything in here, and say copy, then go over to variables, and right below here we'll just paste. If this doesn't quite make sense, just follow along. I think you'll get the hang of what I'm doing as we do it. Let's go up to the top of our file and start up here. We've already got our instance type. Let's see if we can find some things we want to make into variables in this data block. So it looks like the main things we'd probably want to change here are the name of the actual AMI image itself, and maybe the owner name down here. So if we…

Contents