Skip to content

snowplow-devops/terraform-aws-rds

Repository files navigation

Release CI License Registry

terraform-aws-rds

A Terraform module for deploying a simple RDS instance.

Usage

module "instance" {
  source = "snowplow-devops/rds/aws"

  name        = "test-rds-instance"
  vpc_id      = local.vpc_id
  subnet_ids  = local.subnet_ids
  db_name     = "snowplow"
  db_username = "snowplow"
  db_password = "$N0wPL0W"
}

Requirements

Name Version
terraform >= 1.0.0
aws >= 4
random >= 3

Providers

Name Version
aws >= 4
random >= 3

Modules

No modules.

Resources

Name Type
aws_db_instance.instance resource
aws_db_subnet_group.subnet_group resource
aws_security_group.sg resource
aws_security_group_rule.ingress_rds resource
random_string.snapshot_id_suffix resource

Inputs

Name Description Type Default Required
db_name The name of the database to create string n/a yes
db_password The password of the administration user to create string n/a yes
db_username The name of the administration user to create string n/a yes
name A name which will be pre-pended to the resources created string n/a yes
subnet_ids The list of subnets to deploy the RDS instance across list(string) n/a yes
vpc_id The VPC to deploy the RDS instance within string n/a yes
additional_ip_allowlist An optional list of CIDR ranges to allow traffic from list(any) [] no
additional_security_group_ids An optional list of security groups to attach to the RDS instance list(any) [] no
allocated_storage The size of the attached disk in GB number 10 no
auto_minor_version_upgrade Whether to automatically upgrade minor versions bool true no
backup_retention_period The number of days to retain backups number 7 no
ca_cert_identifier Identifier of the CA certificate for the DB instance. Example: rds-ca-2019, rds-ca-rsa2048-g1, rds-ca-ecc384-g1, or rds-ca-rsa4096-g1. string "rds-ca-2019" no
deletion_protection Whether to protect the RDS from accidental termination bool false no
enabled_cloudwatch_logs_exports A list of log types to enable for exporting to CloudWatch Logs. Valid values for postgres are: postgresql and upgrade. See https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_LogAccess.Concepts.PostgreSQL.html. list(string) [] no
engine The engine type to use in the RDS instance string "postgres" no
instance_class The instance type to use string "db.t3.micro" no
max_allocated_storage The maximum size of the attached disk in GB - if set higher than allocated_storage will enable auto-scaling number 0 no
monitoring_interval The interval, in seconds, between points when Enhanced Monitoring metrics are collected for the DB instance. Valid Values: 0, 1, 5, 10, 15, 30, 60. number 0 no
monitoring_role_arn The ARN for the IAM role that permits RDS to send enhanced monitoring metrics to CloudWatch Logs. string "" no
multi_az Whether to deploy the RDS across multiple availability zones bool false no
port The port to deploy the database on number 5432 no
publicly_accessible Whether to make this instance accessible over the internet bool false no
snapshot_identifier The identifier of a snapshot to restore from string "" no
tags The tags to append to this resource map(string) {} no

Outputs

Name Description
address Address which the RDS instance is bound to
id ID of the RDS instance
port Port which the RDS instance exposes (e.g. 5432)
sg_id ID of the security group attached to the RDS instance

Copyright and license

The Terraform AWS RDS project is Copyright 2021-2023 Snowplow Analytics Ltd.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this software except in compliance with the License.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.