Skip to content

Commit

Permalink
RDS multi AZ (#8)
Browse files Browse the repository at this point in the history
* update readme

* ensure publicly_accessible is a boolean

* allow setting multi_az (defaults to false)
  • Loading branch information
swiknaba authored Jul 5, 2021
1 parent 030eea1 commit c2c52db
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 11 deletions.
24 changes: 15 additions & 9 deletions rds/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,22 @@ Used for creating and configuring databases and their networking.

```
module "db" {
source = "github.com/dbl-works/terraform//rds"
vpc_id = "vpc-123"
project = "someproject"
environment = "staging"
password = "xxx"
subnet_ids = [ "subnet-1", "subnet-2" ]
kms_key_arn = "arn:aws:kms:eu-central-1:12345678:key/xxx-xxx"
source = "github.com/dbl-works/terraform//rds?ref=v2021.07.01"
vpc_id = "vpc-123"
project = "someproject"
environment = "staging"
password = "xxx"
kms_key_arn = "arn:aws:kms:eu-central-1:12345678:key/xxx-xxx"
subnet_ids = ["subnet-1", "subnet-2"]
allow_from_security_groups = [module.ecs.ecs_security_group_id]
# optional
instance_class = "db.t3.micro"
engine_version = "13.2"
publicly_accessible = false
allocated_storage = 100
multi_az = false
}
```

Expand Down
2 changes: 1 addition & 1 deletion rds/rds.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ resource "aws_db_instance" "main" {
password = var.password
parameter_group_name = aws_db_parameter_group.postgres13.name
apply_immediately = true
multi_az = false
multi_az = var.multi_az
publicly_accessible = var.publicly_accessible
deletion_protection = true
vpc_security_group_ids = [
Expand Down
11 changes: 10 additions & 1 deletion rds/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,18 @@ variable "environment" {}

variable "instance_class" { default = "db.t3.micro" }
variable "engine_version" { default = "13.2" }
variable "publicly_accessible" { default = false }
variable "allocated_storage" { default = 100 }

variable "publicly_accessible" {
type = bool
default = false
}

variable "multi_az" {
type = bool
default = false
}

# Credentials for the root RDS user
# Only to be used in initial setup, never by applications
variable "username" { default = "root" }
Expand Down

0 comments on commit c2c52db

Please sign in to comment.