|
| 1 | +output "instance_id" { |
| 2 | + description = "EC2 instance ID" |
| 3 | + value = aws_instance.main.id |
| 4 | +} |
| 5 | + |
| 6 | +output "data_volume_id" { |
| 7 | + description = "EBS data volume ID (for snapshots)" |
| 8 | + value = aws_ebs_volume.data.id |
| 9 | +} |
| 10 | + |
| 11 | +output "public_ip" { |
| 12 | + description = "Public IP address" |
| 13 | + value = var.use_elastic_ip ? aws_eip.main[0].public_ip : aws_instance.main.public_ip |
| 14 | +} |
| 15 | + |
| 16 | +output "grafana_url" { |
| 17 | + description = "Grafana dashboard URL" |
| 18 | + value = "http://${var.use_elastic_ip ? aws_eip.main[0].public_ip : aws_instance.main.public_ip}:3000" |
| 19 | +} |
| 20 | + |
| 21 | +output "ssh_command" { |
| 22 | + description = "SSH command to connect" |
| 23 | + value = "ssh -i ~/.ssh/${var.ssh_key_name}.pem ubuntu@${var.use_elastic_ip ? aws_eip.main[0].public_ip : aws_instance.main.public_ip}" |
| 24 | +} |
| 25 | + |
| 26 | +output "grafana_credentials" { |
| 27 | + description = "Grafana credentials" |
| 28 | + value = { |
| 29 | + username = "monitor" |
| 30 | + password = var.grafana_password |
| 31 | + } |
| 32 | + sensitive = true |
| 33 | +} |
| 34 | + |
| 35 | +output "deployment_info" { |
| 36 | + description = "Deployment information" |
| 37 | + value = { |
| 38 | + instance_type = var.instance_type |
| 39 | + region = var.aws_region |
| 40 | + public_ip = var.use_elastic_ip ? aws_eip.main[0].public_ip : aws_instance.main.public_ip |
| 41 | + data_volume = "${var.data_volume_size} GiB" |
| 42 | + api_key_configured = var.postgres_ai_api_key != "" |
| 43 | + monitoring_instances = length(var.monitoring_instances) |
| 44 | + demo_mode = var.enable_demo_db |
| 45 | + } |
| 46 | + sensitive = true |
| 47 | +} |
| 48 | + |
| 49 | +output "next_steps" { |
| 50 | + description = "Next steps after deployment" |
| 51 | + value = <<-EOT |
| 52 | +
|
| 53 | +Deployment complete |
| 54 | +
|
| 55 | +Grafana URL: http://${var.use_elastic_ip ? aws_eip.main[0].public_ip : aws_instance.main.public_ip}:3000 |
| 56 | +Username: monitor |
| 57 | +Password: (from terraform.tfvars) |
| 58 | +
|
| 59 | +Monitoring: ${length(var.monitoring_instances)} instance(s) |
| 60 | +API key: ${var.postgres_ai_api_key != "" ? "configured" : "not configured"} |
| 61 | +
|
| 62 | +SSH: ssh -i ~/.ssh/${var.ssh_key_name}.pem ubuntu@${var.use_elastic_ip ? aws_eip.main[0].public_ip : aws_instance.main.public_ip} |
| 63 | +Backup: aws ec2 create-snapshot --volume-id ${aws_ebs_volume.data.id} |
| 64 | +
|
| 65 | +EOT |
| 66 | +} |
| 67 | + |
0 commit comments