1
00:00:00,300 --> 00:00:05,070
Finally we're going to talk about the conditions and so conditions are used to control the creation

2
00:00:05,070 --> 00:00:10,890
of resources or outputs based on some statements logical statements and the conditions can be whatever

3
00:00:10,890 --> 00:00:11,570
you want them to be.

4
00:00:11,580 --> 00:00:16,830
But the common ones are that maybe you want to say if you're in dive or if you're interested or if you're

5
00:00:16,830 --> 00:00:22,680
in project create or don't create that resource maybe it can be based on the region maybe based on the

6
00:00:22,680 --> 00:00:23,750
perimeter value.

7
00:00:23,810 --> 00:00:29,160
And so each condition can reference another condition private value or mapping so you can compose them.

8
00:00:29,160 --> 00:00:31,620
And so to define them to make it a bit more concrete.

9
00:00:31,680 --> 00:00:35,820
Here is a condition that I've created under the block conditions.

10
00:00:35,820 --> 00:00:43,050
And so we hear we say okay do we want you create the production resources and for this you need to have

11
00:00:43,050 --> 00:00:47,550
the environment type in that maybe you Pam enter this environment type right here.

12
00:00:47,550 --> 00:00:48,930
We need to have the reference.

13
00:00:48,930 --> 00:00:56,340
So the value of this parameter to be equal to prod be our ODA the string prod.

14
00:00:56,340 --> 00:01:03,580
And so here basically this whole thing is going to be true only if the environment is equal to broad.

15
00:01:04,050 --> 00:01:10,590
And so using this broad resources we're able to basically define and condition other resources.

16
00:01:10,610 --> 00:01:12,830
So it's up to you how you want to choose it.

17
00:01:12,900 --> 00:01:18,710
And so the all the function you can use in there are going to be and equals if not or or.

18
00:01:18,720 --> 00:01:22,890
And so these are logical functions and you can compose them as much as you want.

19
00:01:22,890 --> 00:01:24,470
Now how do we use a condition.

20
00:01:24,480 --> 00:01:28,060
Well you can apply it as a set of resources outputs et cetera.

21
00:01:28,110 --> 00:01:35,220
And so if we look at a resource for example my mounts points at the type of it is a it was easy to volume

22
00:01:35,220 --> 00:01:36,100
attachments.

23
00:01:36,270 --> 00:01:42,480
And this only gets created if the condition creates proud resources from before is true.

24
00:01:43,170 --> 00:01:49,180
So that gives you an idea of how conditions are used basically on the same level as the type.

25
00:01:49,230 --> 00:01:52,590
Right here underneath the name of the resource.

26
00:01:52,710 --> 00:01:54,150
So that's it for conditions.

27
00:01:54,150 --> 00:01:55,650
I think they're pretty much advance.

28
00:01:55,650 --> 00:01:59,490
I'm not sure they're asked at the exam but for you it's still good to know about them that the exists

29
00:01:59,790 --> 00:02:03,570
and you can have some a little bit more logic in your in your confirmation templates.

30
00:02:03,570 --> 00:02:04,520
I hope that was helpful.

31
00:02:04,530 --> 00:02:06,140
And I will see you in the next lecture.
