From the course: Introduction to Terraform on Google Cloud Platform

Unlock the full course today

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

Split out your data

Split out your data

- [Instructor] Before we start using modules, let's refactor the hard-coded values in our code to use variables. This is the first step in creating our own module, but it's also just a helpful way to clean up the code. So first we're going to go to our code repo and just open that in a new tab. Go down to the variables.tf and go to the github.dev editor. We'll be editing a couple of files, so it's easier to use this editor than the simple editor. The way I like to tackle this kind of work is to start by copying all of the code into the variables file first, and then create variables out of anything that's hard coded, that saves a lot of back and forth with copy and paste. So open up the main.tf file and copy everything out of there and then paste that into the variables file. And with this editor, we'll need to use keyboard commands in order to copy and paste, so I'm using Control + V. On a Mac, you'd use Command + V. And then go to providers, copy that, and you could use Control + C…

Contents