feat: Add sample Terraform code for HCL language testing

This commit is contained in:
Paul Gauthier (aider) 2025-02-07 10:53:28 -08:00
parent 1408fb41b8
commit a58293f04b
2 changed files with 53 additions and 0 deletions

View file

@ -303,6 +303,7 @@ class TestRepoMapAllLanguages(unittest.TestCase):
"elisp": ("el", "greeter"),
"elm": ("elm", "Person"),
"go": ("go", "Greeter"),
"hcl": ("tf", "aws_vpc"),
}
fixtures_dir = Path(__file__).parent.parent / "fixtures" / "languages"

View file

@ -0,0 +1,52 @@
# 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
}