1 00:00:07,000 --> 00:00:09,110 - In this lesson, we're gonna learn about 2 00:00:09,980 --> 00:00:14,110 the HashiCorp configuration language, commonly known as HCL. 3 00:00:14,110 --> 00:00:15,073 This is the, 4 00:00:16,530 --> 00:00:20,170 the configuration language that we use to tell Terraform 5 00:00:21,990 --> 00:00:24,490 the state that we want our cloud provider to be in, 6 00:00:24,490 --> 00:00:29,190 so we're gonna list all the resources that are required 7 00:00:29,190 --> 00:00:31,103 for our solution, 8 00:00:32,160 --> 00:00:33,793 using HCL. 9 00:00:35,350 --> 00:00:40,350 So let's just start out talking about the project layout 10 00:00:40,440 --> 00:00:43,460 for a Terraform project. 11 00:00:43,460 --> 00:00:46,240 You can see here, if you look at my screen, 12 00:00:46,240 --> 00:00:47,750 we've got, 13 00:00:47,750 --> 00:00:49,290 we've got three files 14 00:00:50,210 --> 00:00:52,290 in a folder. 15 00:00:52,290 --> 00:00:54,430 Okay, so Terraform is 16 00:00:55,560 --> 00:00:58,550 specified by its context, so a folder 17 00:00:59,860 --> 00:01:01,270 with 18 00:01:01,270 --> 00:01:06,270 HCL files or .tf files constitutes what's called a module. 19 00:01:06,810 --> 00:01:09,170 Now in this case, it's the root module, 20 00:01:09,170 --> 00:01:12,770 and we'll get into some modules in 21 00:01:13,739 --> 00:01:15,080 a later lesson. 22 00:01:15,080 --> 00:01:17,250 But for right now, you need to know 23 00:01:17,250 --> 00:01:19,560 that everything in this directory 24 00:01:19,560 --> 00:01:24,560 is considered to be part of the Terraform configuration. 25 00:01:25,150 --> 00:01:27,690 It doesn't matter which of these files 26 00:01:28,780 --> 00:01:31,673 the resources or other objects are listed in. 27 00:01:32,980 --> 00:01:34,283 By convention, 28 00:01:35,700 --> 00:01:39,040 there's always a file called main.tf, 29 00:01:39,040 --> 00:01:42,143 outputs.tf, and variables.tf. 30 00:01:43,870 --> 00:01:48,870 Main is typically where all the resources are declared. 31 00:01:49,300 --> 00:01:51,300 Outputs is where the outputs are declared, 32 00:01:51,300 --> 00:01:53,760 and variables are where the variables are declared, 33 00:01:53,760 --> 00:01:55,960 and we'll talk about what outputs and variables are, 34 00:01:55,960 --> 00:01:57,460 we haven't gone over that yet. 35 00:01:59,150 --> 00:02:00,680 But we'll talk about that soon. 36 00:02:00,680 --> 00:02:04,490 Sometimes, if main becomes very large, 37 00:02:04,490 --> 00:02:06,750 there will be additional TF files in here, 38 00:02:06,750 --> 00:02:10,390 but that's usually a good time to start using modules. 39 00:02:10,390 --> 00:02:13,560 And again, we'll talk about those in a later lesson. 40 00:02:13,560 --> 00:02:16,750 But for now, just realize that 41 00:02:16,750 --> 00:02:19,560 the contents of the directory 42 00:02:19,560 --> 00:02:23,020 define the extent of the Terraform configuration. 43 00:02:23,020 --> 00:02:25,390 And that is not recursive, so it's 44 00:02:25,390 --> 00:02:27,670 everything in the top level here. 45 00:02:27,670 --> 00:02:29,920 You can do a normal 46 00:02:33,380 --> 00:02:34,463 Terraforming knit. 47 00:02:35,870 --> 00:02:36,900 And... 48 00:02:43,380 --> 00:02:44,680 Okay, now this has read 49 00:02:45,770 --> 00:02:48,090 the configuration in all three of these files 50 00:02:48,090 --> 00:02:49,180 in order to do 51 00:02:50,070 --> 00:02:52,587 its plan and, 52 00:02:52,587 --> 00:02:53,420 and a knit. 53 00:02:53,420 --> 00:02:55,070 It doesn't matter which of these files 54 00:02:55,070 --> 00:02:56,360 you list your resource in. 55 00:02:56,360 --> 00:02:59,320 It doesn't matter what order your resources are listed in. 56 00:02:59,320 --> 00:03:02,523 So we'll talk about that as we get further into this.