From the course: Hashicorp Certified Terraform Associate (003) Cert Prep
Unlock the full course today
Join today to access over 24,900 courses taught by industry experts.
Looping and creating multiple instances - Terraform Tutorial
From the course: Hashicorp Certified Terraform Associate (003) Cert Prep
Looping and creating multiple instances
- [Instructor] Resource dependencies in Terraform. So in Terraform, dependencies refers to the relationship between resources in a configuration. Terraform uses this information to determine the correct order in which to create or modify your resources. So here, I have the configuration, just walk to you through how the depends_on works. Okay, so I have resource block here for aws_security_group for creating EC2 instance. Whenever you see me use dot, dot, dot here, which I have actually commented out is just to show that that other parameters that should come with it. I just want to manage the space. So this is for creating AWS security group. This is for EC2 instance. And here, I am explicitly specifying the dependency on the security group. I just want to tell Terraform that AWS EC2 instance here depends on the existence of my resource group, okay? So I want Terraform to provision the resource group first before EC2 instance. So this is a way to let Terraform note that it shouldn't…
Contents
-
-
-
-
-
-
-
-
-
-
(Locked)
Uses of variables8m 38s
-
(Locked)
Uses of outputs3m 44s
-
(Locked)
Creating Terraform.tfvars file8m 27s
-
(Locked)
Secure secret injection best practice10m 13s
-
(Locked)
Understand the use of collection and structural types12m 13s
-
(Locked)
Create and differentiate resource and data configuration7m 13s
-
(Locked)
Looping and creating multiple instances8m 55s
-
(Locked)
Resource addressing and resource parameters6m 57s
-
(Locked)
HCL and Terraform functions to write configuration13m 30s
-
(Locked)
Create and differentiate resource and data configuration5m 49s
-
(Locked)
-
-