From a58293f04baab72685217bb334e1f13f7a2fd9b0 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Fri, 7 Feb 2025 10:53:28 -0800 Subject: [PATCH] feat: Add sample Terraform code for HCL language testing --- tests/basic/test_repomap.py | 1 + tests/fixtures/languages/hcl/teraform.tf | 52 ++++++++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/tests/basic/test_repomap.py b/tests/basic/test_repomap.py index a007ba3f0..d5770b2c1 100644 --- a/tests/basic/test_repomap.py +++ b/tests/basic/test_repomap.py @@ -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" diff --git a/tests/fixtures/languages/hcl/teraform.tf b/tests/fixtures/languages/hcl/teraform.tf index e69de29bb..8b58c2311 100644 --- a/tests/fixtures/languages/hcl/teraform.tf +++ b/tests/fixtures/languages/hcl/teraform.tf @@ -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 +}