# Variables variable "aws_region" { description = "AWS region for resources" type = string default = "us-west-2" } variable "environment" { description = "Environment name" type = string default = "dev" } # Provider configuration provider "aws" { region = var.aws_region } # Resource definitions resource "aws_vpc" "main" { cidr_block = "10.0.0.0/16" enable_dns_hostnames = true enable_dns_support = true tags = { Name = "${var.environment}-vpc" Environment = var.environment } } resource "aws_subnet" "public" { vpc_id = aws_vpc.main.id cidr_block = "10.0.1.0/24" availability_zone = "${var.aws_region}a" map_public_ip_on_launch = true tags = { Name = "${var.environment}-public-subnet" Environment = var.environment } } # Output values output "vpc_id" { description = "ID of the created VPC" value = aws_vpc.main.id } output "subnet_id" { description = "ID of the public subnet" value = aws_subnet.public.id }