Skip to content

Commit 77ee8a0

Browse files
committed
wip benchmarks
1 parent d19c1ea commit 77ee8a0

File tree

14 files changed

+774
-0
lines changed

14 files changed

+774
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Benchmark: Simple Null Resource
2+
# Purpose: Baseline test for minimal Terraform execution overhead
3+
4+
terraform {
5+
cloud {
6+
hostname = "otaco.app"
7+
organization = "org_01K8RTMAHF3QTTX62SSE0757AM"
8+
workspaces {
9+
name = "028448c3-cefd-42c2-872c-f8ce055b5554"
10+
}
11+
}
12+
}
13+
14+
resource "null_resource" "simple" {
15+
triggers = {
16+
timestamp = timestamp()
17+
}
18+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Benchmark: 10,000 Null Resources
2+
# Purpose: Test performance with large number of resources
3+
4+
terraform {
5+
cloud {
6+
hostname = "otaco.app"
7+
organization = "org_01K8RTMAHF3QTTX62SSE0757AM"
8+
workspaces {
9+
name = "028448c3-cefd-42c2-872c-f8ce055b5554"
10+
}
11+
}
12+
}
13+
14+
resource "null_resource" "massive" {
15+
count = 10000
16+
17+
triggers = {
18+
index = count.index
19+
}
20+
}
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
# Benchmark: EC2 Midsize Instance
2+
# Purpose: Test real-world cloud resource provisioning
3+
4+
terraform {
5+
cloud {
6+
hostname = "otaco.app"
7+
organization = "org_01K8RTMAHF3QTTX62SSE0757AM"
8+
workspaces {
9+
name = "028448c3-cefd-42c2-872c-f8ce055b5554"
10+
}
11+
}
12+
13+
required_providers {
14+
aws = {
15+
source = "hashicorp/aws"
16+
version = "~> 5.0"
17+
}
18+
}
19+
}
20+
21+
provider "aws" {
22+
region = var.aws_region
23+
}
24+
25+
variable "aws_region" {
26+
description = "AWS region for resources"
27+
type = string
28+
default = "us-east-1"
29+
}
30+
31+
# VPC for the instance
32+
resource "aws_vpc" "benchmark" {
33+
cidr_block = "10.0.0.0/16"
34+
enable_dns_hostnames = true
35+
enable_dns_support = true
36+
37+
tags = {
38+
Name = "opentaco-benchmark-vpc"
39+
Benchmark = "ec2-midsize"
40+
}
41+
}
42+
43+
# Subnet
44+
resource "aws_subnet" "benchmark" {
45+
vpc_id = aws_vpc.benchmark.id
46+
cidr_block = "10.0.1.0/24"
47+
availability_zone = data.aws_availability_zones.available.names[0]
48+
map_public_ip_on_launch = true
49+
50+
tags = {
51+
Name = "opentaco-benchmark-subnet"
52+
Benchmark = "ec2-midsize"
53+
}
54+
}
55+
56+
# Internet Gateway
57+
resource "aws_internet_gateway" "benchmark" {
58+
vpc_id = aws_vpc.benchmark.id
59+
60+
tags = {
61+
Name = "opentaco-benchmark-igw"
62+
Benchmark = "ec2-midsize"
63+
}
64+
}
65+
66+
# Route table
67+
resource "aws_route_table" "benchmark" {
68+
vpc_id = aws_vpc.benchmark.id
69+
70+
route {
71+
cidr_block = "0.0.0.0/0"
72+
gateway_id = aws_internet_gateway.benchmark.id
73+
}
74+
75+
tags = {
76+
Name = "opentaco-benchmark-rt"
77+
Benchmark = "ec2-midsize"
78+
}
79+
}
80+
81+
# Route table association
82+
resource "aws_route_table_association" "benchmark" {
83+
subnet_id = aws_subnet.benchmark.id
84+
route_table_id = aws_route_table.benchmark.id
85+
}
86+
87+
# Security group
88+
resource "aws_security_group" "benchmark" {
89+
name = "opentaco-benchmark-sg"
90+
description = "Security group for benchmark EC2 instance"
91+
vpc_id = aws_vpc.benchmark.id
92+
93+
egress {
94+
from_port = 0
95+
to_port = 0
96+
protocol = "-1"
97+
cidr_blocks = ["0.0.0.0/0"]
98+
}
99+
100+
tags = {
101+
Name = "opentaco-benchmark-sg"
102+
Benchmark = "ec2-midsize"
103+
}
104+
}
105+
106+
# Data source for AMI
107+
data "aws_ami" "ubuntu" {
108+
most_recent = true
109+
owners = ["099720109477"] # Canonical
110+
111+
filter {
112+
name = "name"
113+
values = ["ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*"]
114+
}
115+
116+
filter {
117+
name = "virtualization-type"
118+
values = ["hvm"]
119+
}
120+
}
121+
122+
# Data source for availability zones
123+
data "aws_availability_zones" "available" {
124+
state = "available"
125+
}
126+
127+
# EC2 Instance (t3.medium)
128+
resource "aws_instance" "benchmark" {
129+
ami = data.aws_ami.ubuntu.id
130+
instance_type = "t3.medium"
131+
subnet_id = aws_subnet.benchmark.id
132+
133+
vpc_security_group_ids = [aws_security_group.benchmark.id]
134+
135+
root_block_device {
136+
volume_type = "gp3"
137+
volume_size = 20
138+
}
139+
140+
tags = {
141+
Name = "opentaco-benchmark-instance"
142+
Benchmark = "ec2-midsize"
143+
}
144+
}
145+
146+
output "instance_id" {
147+
description = "ID of the EC2 instance"
148+
value = aws_instance.benchmark.id
149+
}
150+
151+
output "instance_public_ip" {
152+
description = "Public IP of the EC2 instance"
153+
value = aws_instance.benchmark.public_ip
154+
}

0 commit comments

Comments
 (0)