‫Finally, we are going to talk about
‫the conditions.
‫So conditions are used to control the creation
‫of resources, or outputs based on some statements.
‫Logical statements.
‫The conditions can be whatever you want them to be,
‫but the common ones are that, maybe you want to say,
‫if you're in dev, or if you're in test,
‫or if you're in prod create or don't create that resource.
‫Maybe it can be based on the region,
‫maybe based on the parameter value.
‫Each condition can reference another condition,
‫parameter value or mapping, so you can compose them.
‫So to define them, to make it a little more concrete,
‫here is a condition that I've created
‫under the block conditions.
‫Here we say, okay, do we want to create
‫the production resources?
‫For this, you need to have the environment type,
‫and that may be a parameter.
‫This environment type right here.
‫We need to have the reference,
‫so the value of this paramater to be equal to prod,
‫P-R-O-D, the string prod.
‫So here, basically, this whole thing is going to be true,
‫only if the environment is equal to prod.
‫Using this prod resources we are able to,
‫basically define and condition other resources.
‫It's up to you how you wanna chose it,
‫all the functions you can use in there are going to be
‫And, Equals, If, Not or, Or.
‫These are logical functions,
‫and you can compose them as much as you want.
‫Now how do we use a condition?
‫Well you can apply it, as I said,
‫to resources, outputs etc.
‫If we look at a resource, for example,
‫my MountPoint, the type of it is a
‫AWS EC2 VolumeAttachment,
‫and this only gets created if the condition
‫CreateProdResources from before is true.
‫That gives you an idea of how conditions are used,
‫basically they're on the same level as the type,
‫right here underneath the name of the Resource.
‫So that's it for conditions,
‫I think they're pretty much advanced,
‫I'm not sure they're asked at the exam,
‫but for you it's still good to know about them,
‫that they exist, and you can have some
‫little bit more logic in your classroom mission templates.
‫I hope that was helpful,
‫and I will see you in the next lecture.