Skip to content

Commit b331947

Browse files
committed
docs: Simplify terraform configuration, remove grafana_password
1 parent 3ff0d34 commit b331947

File tree

5 files changed

+44
-16
lines changed

5 files changed

+44
-16
lines changed

terraform/aws/QUICKSTART.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ cd terraform/aws
1919

2020
# Configure
2121
cp terraform.tfvars.example terraform.tfvars
22-
vim terraform.tfvars # Set ssh_key_name and grafana_password
22+
vim terraform.tfvars # Set ssh_key_name
2323

2424
# Validate
2525
./validate.sh
@@ -39,7 +39,7 @@ terraform output ssh_command
3939
```bash
4040
# Grafana dashboard
4141
open $(terraform output -raw grafana_url)
42-
# Login: monitor / <your grafana_password>
42+
# Login: monitor / demo (or your custom password)
4343

4444
# SSH
4545
ssh -i ~/.ssh/postgres-ai-key.pem ubuntu@$(terraform output -raw public_ip)

terraform/aws/README.md

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,37 @@ See [QUICKSTART.md](QUICKSTART.md) for step-by-step guide.
2525

2626
```hcl
2727
# terraform.tfvars
28-
ssh_key_name = "postgres-ai-key"
29-
grafana_password = "SecurePassword123!"
28+
ssh_key_name = "postgres-ai-key"
29+
30+
# Optional: Set custom Grafana password (defaults to 'demo')
31+
# grafana_password = "YourSecurePassword123!"
3032
```
3133

3234
### Minimal production setup
3335

3436
```hcl
37+
# terraform.tfvars
38+
39+
# REQUIRED PARAMETERS
40+
ssh_key_name = "your-key-name"
41+
42+
# AWS SETTINGS
3543
aws_region = "us-east-1"
3644
environment = "production"
37-
grafana_password = "SecurePassword123!"
45+
instance_type = "t3.medium"
46+
47+
# STORAGE
48+
data_volume_size = 50 # GiB
3849
39-
# Optional: API key for uploading reports to PostgresAI
40-
# Get it from: https://console.postgres.ai → Your Org → Manage → Access Tokens
41-
postgres_ai_api_key = "your-api-key-here"
50+
# SECURITY (restrict access!)
51+
allowed_ssh_cidr = ["0.0.0.0/0"] # WARNING: Allows access from anywhere
52+
allowed_cidr_blocks = ["0.0.0.0/0"] # WARNING: Allows access from anywhere
53+
54+
# OPTIONAL PARAMETERS
55+
# grafana_password = "YourSecurePassword123!" # Defaults to 'demo'
56+
# postgres_ai_api_key = "your-api-key" # For uploading reports
57+
# enable_demo_db = false # true for testing
58+
# use_elastic_ip = true # Stable IP address
4259
4360
monitoring_instances = [
4461
{
@@ -57,20 +74,20 @@ monitoring_instances = [
5774
# AWS
5875
aws_region = "us-east-1"
5976
environment = "production"
60-
instance_type = "t3.large"
77+
instance_type = "t3.medium"
6178
6279
# Storage
63-
data_volume_size = 100
80+
data_volume_size = 50
6481
6582
# Security (restrict access in production)
6683
allowed_ssh_cidr = ["203.0.113.0/24"]
6784
allowed_cidr_blocks = ["203.0.113.0/24"]
6885
6986
# Required
70-
ssh_key_name = "postgres-ai-key"
71-
grafana_password = "SecurePassword123!"
87+
ssh_key_name = "ssh-key"
7288
7389
# Optional
90+
grafana_password = "SecurePassword123!" # Defaults to 'demo'
7491
postgres_ai_api_key = "your-api-key"
7592
enable_demo_db = false
7693
use_elastic_ip = true

terraform/aws/terraform.tfvars.example

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
# SSH key for EC2 access (create in AWS Console or CLI)
88
ssh_key_name = "your-key-name"
99

10-
# Grafana password (minimum 8 characters)
11-
grafana_password = "YourSecurePassword123!"
12-
1310

1411
# AWS SETTINGS
1512
# -------------------------
@@ -80,6 +77,9 @@ monitoring_instances = [
8077
# If not set, reports will be generated locally without upload
8178
# postgres_ai_api_key = "your-api-key-here"
8279

80+
# Grafana admin password (defaults to 'demo')
81+
# grafana_password = "YourSecurePassword123!"
82+
8383
# Enable demo database (for testing)
8484
# enable_demo_db = false
8585

terraform/aws/user_data.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ grafana_password=${grafana_password}
7474
%{ if enable_demo_db }demo_mode=true%{ else }demo_mode=false%{ endif }
7575
EOF
7676

77+
# Create .env file for docker-compose
78+
cat > .env <<ENV_EOF
79+
GRAFANA_PASSWORD=${grafana_password}
80+
ENV_EOF
81+
7782
# Configure monitoring instances
7883
%{ if length(monitoring_instances) > 0 }
7984
cat > instances.yml <<'INSTANCES_EOF'
@@ -135,6 +140,11 @@ systemctl start postgres-ai
135140
# Wait for services to be healthy
136141
sleep 30
137142

143+
# Reset Grafana admin password to match terraform config
144+
echo "Setting Grafana admin password..."
145+
cd /home/postgres_ai/postgres_ai
146+
docker exec grafana-with-datasources grafana-cli admin reset-admin-password "${grafana_password}" 2>/dev/null || true
147+
138148
echo "Installation complete!"
139149
echo "Access Grafana at: http://$(curl -s http://169.254.169.254/latest/meta-data/public-ipv4):3000"
140150
echo "Username: monitor"

terraform/aws/variables.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ variable "use_elastic_ip" {
4646
}
4747

4848
variable "grafana_password" {
49-
description = "Grafana admin password"
49+
description = "Grafana admin password (optional, defaults to 'demo')"
5050
type = string
51+
default = "demo"
5152
sensitive = true
5253
}
5354

0 commit comments

Comments
 (0)