Skip to content

Commit 01e8e69

Browse files
committed
terraform tests: Set default replication factors
Follow-up to MaterializeInc#31452 Seen failing in https://buildkite.com/materialize/nightly/builds/11143#019501e1-d68b-407e-8801-4a60b5a18f5d
1 parent 61dacc0 commit 01e8e69

File tree

3 files changed

+136
-1
lines changed

3 files changed

+136
-1
lines changed
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# Copyright Materialize, Inc. and contributors. All rights reserved.
2+
#
3+
# Use of this software is governed by the Business Source License
4+
# included in the LICENSE file at the root of this repository.
5+
#
6+
# As of the Change Date specified in that file, in accordance with
7+
# the Business Source License, use of this software will be governed
8+
# by the Apache License, Version 2.0.
9+
10+
provider "aws" {
11+
region = "us-east-1"
12+
}
13+
14+
resource "random_password" "db_password" {
15+
length = 32
16+
special = false
17+
}
18+
19+
module "materialize_infrastructure" {
20+
source = "git::https://github.com/MaterializeInc/terraform-aws-materialize.git?ref=v0.2.0"
21+
22+
# Basic settings
23+
# The namespace and environment variables are used to construct the names of the resources
24+
# e.g. ${namespace}-${environment}-eks and etc.
25+
namespace = "aws-test"
26+
environment = "dev"
27+
install_materialize_operator = true
28+
29+
helm_values = {
30+
defaultReplicationFactor = {
31+
system = 1
32+
probe = 1
33+
support = 1
34+
analytics = 1
35+
}
36+
}
37+
38+
# VPC Configuration
39+
vpc_cidr = "10.0.0.0/16"
40+
availability_zones = ["us-east-1a", "us-east-1b"]
41+
private_subnet_cidrs = ["10.0.1.0/24", "10.0.2.0/24"]
42+
public_subnet_cidrs = ["10.0.101.0/24", "10.0.102.0/24"]
43+
single_nat_gateway = true
44+
45+
# EKS Configuration
46+
cluster_version = "1.31"
47+
node_group_instance_types = ["c7a.2xlarge"]
48+
node_group_desired_size = 2
49+
node_group_min_size = 1
50+
node_group_max_size = 3
51+
node_group_capacity_type = "ON_DEMAND"
52+
53+
# Storage Configuration
54+
bucket_force_destroy = true
55+
56+
# For testing purposes, we are disabling encryption and versioning to allow for easier cleanup
57+
# This should be enabled in production environments for security and data integrity
58+
enable_bucket_versioning = false
59+
enable_bucket_encryption = false
60+
61+
# Database Configuration
62+
database_password = random_password.db_password.result
63+
postgres_version = "15"
64+
db_instance_class = "db.t3.micro"
65+
db_allocated_storage = 20
66+
database_name = "materialize"
67+
database_username = "materialize"
68+
db_multi_az = false
69+
70+
# Basic monitoring
71+
enable_monitoring = true
72+
metrics_retention_days = 7
73+
74+
# Tags
75+
tags = {
76+
Environment = "dev"
77+
Project = "aws-test"
78+
Terraform = "true"
79+
}
80+
}
81+
82+
# Generate random suffix for unique S3 bucket name
83+
resource "random_id" "suffix" {
84+
byte_length = 4
85+
}
86+
87+
# outputs.tf
88+
output "eks_cluster_endpoint" {
89+
description = "EKS cluster endpoint"
90+
value = module.materialize_infrastructure.eks_cluster_endpoint
91+
}
92+
93+
output "database_endpoint" {
94+
description = "RDS instance endpoint"
95+
value = module.materialize_infrastructure.database_endpoint
96+
}
97+
98+
output "s3_bucket_name" {
99+
description = "Name of the S3 bucket"
100+
value = module.materialize_infrastructure.s3_bucket_name
101+
}
102+
103+
output "materialize_s3_role_arn" {
104+
description = "The ARN of the IAM role for Materialize"
105+
value = module.materialize_infrastructure.materialize_s3_role_arn
106+
}
107+
108+
output "metadata_backend_url" {
109+
description = "PostgreSQL connection URL in the format required by Materialize"
110+
value = module.materialize_infrastructure.metadata_backend_url
111+
sensitive = true
112+
}
113+
114+
output "persist_backend_url" {
115+
description = "S3 connection URL in the format required by Materialize using IRSA"
116+
value = module.materialize_infrastructure.persist_backend_url
117+
}

test/terraform/aws/main.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ module "materialize_infrastructure" {
2121
mz_iam_service_account_name = "terraform-aws-test-user"
2222
mz_iam_role_name = "terraform-aws-test-s3-role"
2323

24+
helm_values = {
25+
defaultReplicationFactor = {
26+
system = 1
27+
probe = 1
28+
support = 1
29+
analytics = 1
30+
}
31+
}
32+
2433
# VPC Configuration
2534
vpc_cidr = "10.0.0.0/16"
2635
availability_zones = ["us-east-1a", "us-east-1b"]

test/terraform/gcp/main.tf

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,16 @@ module "materialize" {
4141
example = "true"
4242
}
4343

44-
install_materialize_operator = false
44+
install_materialize_operator = true
45+
46+
helm_values = {
47+
defaultReplicationFactor = {
48+
system = 1
49+
probe = 1
50+
support = 1
51+
analytics = 1
52+
}
53+
}
4554
}
4655

4756
variable "project_id" {

0 commit comments

Comments
 (0)