LAB: Terraform Dependencies (Implicit vs Explicit)
π Project Structure terraform-dependency-lab/ β βββ main.tf βββ variables.tf βββ terraform.tfvars βββ outputs.tf βββ providers.tf πΉ 1. providers.tf terraform { required_version = ">= 1.5.0" re...

Source: DEV Community
π Project Structure terraform-dependency-lab/ β βββ main.tf βββ variables.tf βββ terraform.tfvars βββ outputs.tf βββ providers.tf πΉ 1. providers.tf terraform { required_version = ">= 1.5.0" required_providers { aws = { source = "hashicorp/aws" version = "~> 5.0" } } } provider "aws" { region = var.aws_region } πΉ 2. variables.tf (NO HARDCODING) variable "aws_region" { description = "AWS region" type = string } variable "project_name" { description = "Project name" type = string } variable "instance_type" { description = "EC2 instance type" type = string } variable "common_tags" { description = "Common tags" type = map(string) } πΉ 3. terraform.tfvars aws_region = "us-east-2" project_name = "dep-lab" instance_type = "t2.micro" common_tags = { Owner = "Student" Lab = "Dependencies" } πΉ 4. main.tf πΈ Part 1: Implicit Dependency resource "aws_vpc" "main" { cidr_block = "10.0.0.0/16" tags = merge(var.common_tags, { Name = "${var.project_name}-vpc" }) } resource "aws_subnet" "subnet