Skip to content

Commit 9ab743f

Browse files
authored
Merge pull request #30 from datarootsio/ISSUE-27/more-rds-options
Issue 27/more rds options
2 parents c6c15d6 + 676a262 commit 9ab743f

File tree

6 files changed

+66
-42
lines changed

6 files changed

+66
-42
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,14 @@ For now the only authentication option is 'RBAC'. When enabling this, this modul
113113
| rbac\_admin\_lastname | RBAC Lastname (only when airflow\_authentication = 'rbac') | `string` | `"airflow"` | no |
114114
| rbac\_admin\_password | RBAC Password (only when airflow\_authentication = 'rbac') | `string` | `"admin"` | no |
115115
| rbac\_admin\_username | RBAC Username (only when airflow\_authentication = 'rbac') | `string` | `"admin"` | no |
116+
| rds\_allocated\_storage | The allocated storage for the rds db in gibibytes | `number` | `20` | no |
116117
| rds\_availability\_zone | Availability zone for the rds instance | `string` | `"eu-west-1a"` | no |
117118
| rds\_deletion\_protection | Deletion protection for the rds instance | `bool` | `false` | no |
119+
| rds\_engine | The database engine to use. For supported values, see the Engine parameter in [API action CreateDBInstance](https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_CreateDBInstance.html) | `string` | `"postgres"` | no |
118120
| rds\_instance\_class | The class of instance you want to give to your rds db | `string` | `"db.t2.micro"` | no |
119121
| rds\_password | Password of rds | `string` | `""` | no |
120122
| rds\_skip\_final\_snapshot | Whether or not to skip the final snapshot before deleting (mainly for tests) | `bool` | `false` | no |
123+
| rds\_storage\_type | One of `"standard"` (magnetic), `"gp2"` (general purpose SSD), or `"io1"` (provisioned IOPS SSD) | `string` | `"standard"` | no |
121124
| rds\_username | Username of rds | `string` | `"airflow"` | no |
122125
| region | The region to deploy your solution to | `string` | `"eu-west-1"` | no |
123126
| resource\_prefix | A prefix for the create resources, example your company name (be aware of the resource name length) | `string` | n/a | yes |

examples/basic-local-with-requirements/main.tf

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,26 @@ provider "aws" {
1212
}
1313

1414
module "airflow" {
15-
source = "datarootsio/ecs-airflow/aws"
15+
source = "datarootsio/ecs-airflow/aws"
1616

17-
resource_prefix = "my-awesome-company"
18-
resource_suffix = "env"
17+
resource_prefix = "my-awesome-company"
18+
resource_suffix = "env"
1919

20-
vpc_id = "vpc-123456"
21-
public_subnet_ids = ["subnet-456789", "subnet-098765"]
20+
vpc_id = "vpc-123456"
21+
public_subnet_ids = ["subnet-456789", "subnet-098765"]
2222

23-
use_https = false
23+
use_https = false
2424

25-
airflow_executor = "Local"
26-
airflow_py_requirements_path = "./requirements.txt"
27-
airflow_variables = {
28-
AIRFLOW__WEBSERVER__NAVBAR_COLOR : "#e27d60"
29-
}
25+
airflow_executor = "Local"
26+
airflow_py_requirements_path = "./requirements.txt"
27+
airflow_variables = {
28+
AIRFLOW__WEBSERVER__NAVBAR_COLOR : "#e27d60"
29+
}
3030

31-
rds_username = "airflow"
32-
rds_password = "super-secret-pass"
33-
rds_availability_zone = "eu-west-1a"
34-
rds_deletion_protection = false
31+
rds_username = "airflow"
32+
rds_password = "super-secret-pass"
33+
rds_availability_zone = "eu-west-1a"
34+
rds_deletion_protection = false
3535
}
3636

3737
output "airflow_alb_dns" {

examples/basic-sequential-rbac/main.tf

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,22 @@ provider "aws" {
1212
}
1313

1414
module "airflow" {
15-
source = "datarootsio/ecs-airflow/aws"
15+
source = "datarootsio/ecs-airflow/aws"
1616

17-
resource_prefix = "my-awesome-company"
18-
resource_suffix = "env"
17+
resource_prefix = "my-awesome-company"
18+
resource_suffix = "env"
1919

20-
vpc_id = "vpc-123456"
21-
public_subnet_ids = ["subnet-456789", "subnet-098765"]
20+
vpc_id = "vpc-123456"
21+
public_subnet_ids = ["subnet-456789", "subnet-098765"]
2222

23-
airflow_executor = "Sequential"
24-
airflow_py_requirements_path = "./requirements.txt"
25-
airflow_authentication = "rbac"
26-
airflow_variables = {
27-
AIRFLOW__WEBSERVER__NAVBAR_COLOR : "#e27d60"
28-
}
23+
airflow_executor = "Sequential"
24+
airflow_py_requirements_path = "./requirements.txt"
25+
airflow_authentication = "rbac"
26+
airflow_variables = {
27+
AIRFLOW__WEBSERVER__NAVBAR_COLOR : "#e27d60"
28+
}
2929

30-
use_https = false
30+
use_https = false
3131
}
3232

3333
output "airflow_alb_dns" {

examples/basic-sequential/main.tf

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@ provider "aws" {
1212
}
1313

1414
module "airflow" {
15-
source = "datarootsio/ecs-airflow/aws"
15+
source = "datarootsio/ecs-airflow/aws"
1616

17-
resource_prefix = "my-awesome-company"
18-
resource_suffix = "env"
17+
resource_prefix = "my-awesome-company"
18+
resource_suffix = "env"
1919

20-
vpc_id = "vpc-123456"
21-
public_subnet_ids = ["subnet-456789", "subnet-098765"]
20+
vpc_id = "vpc-123456"
21+
public_subnet_ids = ["subnet-456789", "subnet-098765"]
2222

23-
airflow_executor = "Sequential"
24-
airflow_variables = {
25-
AIRFLOW__WEBSERVER__NAVBAR_COLOR : "#e27d60"
26-
}
23+
airflow_executor = "Sequential"
24+
airflow_variables = {
25+
AIRFLOW__WEBSERVER__NAVBAR_COLOR : "#e27d60"
26+
}
2727

28-
use_https = false
28+
use_https = false
2929
}
3030

3131
output "airflow_alb_dns" {

rds.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
resource "aws_db_instance" "airflow" {
22
count = var.postgres_uri != "" || var.airflow_executor == "Sequential" ? 0 : 1
33
name = replace(title(local.rds_name), "-", "")
4-
allocated_storage = 20
5-
storage_type = "standard"
6-
engine = "postgres"
4+
allocated_storage = var.rds_allocated_storage
5+
storage_type = var.rds_storage_type
6+
engine = var.rds_engine
77
engine_version = "11.8"
88
instance_class = var.rds_instance_class
99
username = var.rds_username
@@ -27,4 +27,4 @@ resource "aws_db_subnet_group" "airflow" {
2727
subnet_ids = local.rds_ecs_subnet_ids
2828

2929
tags = local.common_tags
30-
}
30+
}

variables.tf

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,28 @@ variable "postgres_uri" {
206206
default = ""
207207
}
208208

209-
// TODO: Add more rds params
209+
variable "rds_allocated_storage" {
210+
type = number
211+
description = "The allocated storage for the rds db in gibibytes"
212+
default = 20
213+
}
214+
215+
variable "rds_storage_type" {
216+
type = string
217+
description = <<EOT
218+
One of `"standard"` (magnetic), `"gp2"` (general purpose SSD), or `"io1"` (provisioned IOPS SSD)
219+
EOT
220+
default = "standard"
221+
}
222+
223+
variable "rds_engine" {
224+
type = string
225+
description = <<EOT
226+
The database engine to use. For supported values, see the Engine parameter in [API action CreateDBInstance](https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_CreateDBInstance.html)
227+
EOT
228+
default = "postgres"
229+
}
230+
210231
variable "rds_username" {
211232
type = string
212233
description = "Username of rds"

0 commit comments

Comments
 (0)