# variables.tf
variable "resource_prefix" {
description = "Prefix for all resources created by this module"
type = string
}
variable "tags" {
description = "Tags to apply to all resources"
type = map(string)
default = {}
}
Code Style Guidelines
Naming Conventions
# Resource Naming
resource "aws_instance" "web_server" {
name = "${var.environment}-${var.project}-web-server"
}
# Variable Naming
variable "vpc_cidr_block" {
description = "CIDR block for VPC"
type = string
}
Resource Blocks
resource "aws_instance" "web_server" {
# Required parameters first
ami = var.ami_id
instance_type = var.instance_type
# Optional/computed parameters
tags = merge(
var.common_tags,
{
Name = "web-server"
}
)
# Nested blocks last
root_block_device {
volume_size = 20
}
}