1
0
mirror of synced 2026-01-01 18:02:53 -05:00
Files
airbyte/airbyte-integrations/infrastructure/ssh_tunnel/module/database.tf
Sherif A. Nada 2e3dfccc68 Setup terraform structure for connector dev infra for GCP and AWS (#4641)
* setup GCP terraform structure for connector dev infra

* fxes

* Created aws terraform bootstrap infrastructure

* Corrected path for S3 state file

* Creating ssh tunnel testing infrastructure

* Creating a bastion host

* Docs

* Created bastion host with airbyte unprivileged account for tunneling

* Added yum updates

* Create a private subnet and a postgres database within it

* Identifier for db

* Create postgres and bastion within a module.

* Set up postgres infrastructure

* Don't need this terraform wrapper when we run with tfenv

* Dropped incomplete WIP from GCP setup for this PR.

* Touchups to how to use terraform

* Updated to resolve merge conflict

* More separated top level structure to avoid monorepo problems with terraform destroy.

* Clarifying directory structure

* Migrated directory structure for testing infrastructure

Co-authored-by: Jenny Brown <jenny@airbyte.io>
2021-08-03 16:39:26 -05:00

46 lines
1.6 KiB
HCL

# Sets up a postgres instance for use in running airbyte connector test cases.
# Tell the database what subnet to belong to, so it joins the right subnets and is routable from the bastion.
# AWS insists on a minimum of two availability zones for an RDS instance even if we don't care about high availability.
resource "aws_db_subnet_group" "default" {
name = "dbtunnel-public-dbsubnet-group"
subnet_ids = [aws_subnet.main-subnet-public-dbtunnel.id, aws_subnet.main-subnet-private-dbtunnel.id]
tags = {
Name = "dbtunnel-public-dbsubnet-group"
}
}
# This is mainly a placeholder for settings we might want to configure later.
resource "aws_db_parameter_group" "default" {
name = "rds-pg"
family = "postgres12"
description = "RDS default parameter group"
#parameter {
# name = "character_set_client"
# value = "utf8"
#}
}
# Create the postgres instance on RDS so it's fully managed and low maintenance.
# For now all we care about is testing with postgres.
resource "aws_db_instance" "default" {
allocated_storage = 5
engine = "postgres"
engine_version = "12.6"
identifier = "tunnel-dev"
instance_class = var.rds_instance_class
db_subnet_group_name = aws_db_subnet_group.default.name
name = "airbyte"
username = "airbyte"
password = chomp(file("${path.module}/secrets/aws_db_instance-master-password"))
parameter_group_name = aws_db_parameter_group.default.name
publicly_accessible = false
skip_final_snapshot = true
apply_immediately = true
vpc_security_group_ids = [aws_security_group.dbtunnel-sg.id]
}