Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.4.0
rev: v3.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: check-merge-conflict
- repo: git://github.com/antonbabenko/pre-commit-terraform
rev: v1.25.0
rev: v1.45.0
hooks:
- id: terraform_fmt
- id: terraform_docs
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ Special thanks to [villasv/aws-airflow-stack](https://github.com/villasv/aws-air
| custom\_env | Path to custom airflow environments variables. | `string` | `null` | no |
| custom\_requirements | Path to custom requirements.txt. | `string` | `null` | no |
| db\_allocated\_storage | Dabatase disk size. | `string` | `20` | no |
| db\_max\_allocated\_storage | Specifies the value for Storage Autoscaling | `number` | `0` | no |
| db\_dbname | PostgreSQL database name. | `string` | `"airflow"` | no |
| db\_instance\_type | Instance type for PostgreSQL database | `string` | `"db.t2.micro"` | no |
| db\_password | PostgreSQL password. | `string` | n/a | yes |
Expand Down
8 changes: 4 additions & 4 deletions labels.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module "airflow_labels" {
source = "git::https://github.com/cloudposse/terraform-terraform-label.git?ref=tags/0.4.0"
source = "git::https://github.com/cloudposse/terraform-terraform-label.git?ref=tags/0.5.0"
namespace = var.cluster_name
stage = var.cluster_stage
name = "airflow"
Expand All @@ -8,7 +8,7 @@ module "airflow_labels" {
}

module "airflow_labels_scheduler" {
source = "git::https://github.com/cloudposse/terraform-terraform-label.git?ref=tags/0.4.0"
source = "git::https://github.com/cloudposse/terraform-terraform-label.git?ref=tags/0.5.0"
namespace = var.cluster_name
stage = var.cluster_stage
name = "airflow"
Expand All @@ -18,7 +18,7 @@ module "airflow_labels_scheduler" {
}

module "airflow_labels_webserver" {
source = "git::https://github.com/cloudposse/terraform-terraform-label.git?ref=tags/0.4.0"
source = "git::https://github.com/cloudposse/terraform-terraform-label.git?ref=tags/0.5.0"
namespace = var.cluster_name
stage = var.cluster_stage
name = "airflow"
Expand All @@ -28,7 +28,7 @@ module "airflow_labels_webserver" {
}

module "airflow_labels_worker" {
source = "git::https://github.com/cloudposse/terraform-terraform-label.git?ref=tags/0.4.0"
source = "git::https://github.com/cloudposse/terraform-terraform-label.git?ref=tags/0.5.0"
namespace = var.cluster_name
stage = var.cluster_stage
name = "airflow"
Expand Down
9 changes: 5 additions & 4 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ resource "aws_sqs_queue" "airflow_queue" {
# ---------------------------------------

module "ami_instance_profile" {
source = "git::https://github.com/traveloka/terraform-aws-iam-role//modules/instance?ref=tags/v1.0.2"
source = "git::https://github.com/traveloka/terraform-aws-iam-role//modules/instance?ref=tags/v2.0.2"
service_name = module.airflow_labels.namespace
cluster_role = module.airflow_labels.stage
environment = module.airflow_labels.stage
Expand Down Expand Up @@ -105,7 +105,7 @@ resource "aws_instance" "airflow_webserver" {
ami = var.ami
key_name = aws_key_pair.auth.id
vpc_security_group_ids = [module.sg_airflow.this_security_group_id]
subnet_id = coalesce("${var.instance_subnet_id}", tolist(data.aws_subnet_ids.all.ids)[0])
subnet_id = coalesce(var.instance_subnet_id, tolist(data.aws_subnet_ids.all.ids)[0])
iam_instance_profile = module.ami_instance_profile.instance_profile_name

associate_public_ip_address = true
Expand Down Expand Up @@ -199,7 +199,7 @@ resource "aws_instance" "airflow_scheduler" {
ami = var.ami
key_name = aws_key_pair.auth.id
vpc_security_group_ids = [module.sg_airflow.this_security_group_id]
subnet_id = coalesce("${var.instance_subnet_id}", tolist(data.aws_subnet_ids.all.ids)[0])
subnet_id = coalesce(var.instance_subnet_id, tolist(data.aws_subnet_ids.all.ids)[0])
iam_instance_profile = module.ami_instance_profile.instance_profile_name

associate_public_ip_address = true
Expand Down Expand Up @@ -293,7 +293,7 @@ resource "aws_instance" "airflow_worker" {
ami = var.ami
key_name = aws_key_pair.auth.id
vpc_security_group_ids = [module.sg_airflow.this_security_group_id]
subnet_id = coalesce("${var.instance_subnet_id}", tolist(data.aws_subnet_ids.all.ids)[0])
subnet_id = coalesce(var.instance_subnet_id, tolist(data.aws_subnet_ids.all.ids)[0])
iam_instance_profile = module.ami_instance_profile.instance_profile_name

associate_public_ip_address = true
Expand Down Expand Up @@ -409,6 +409,7 @@ module "sg_database" {
resource "aws_db_instance" "airflow_database" {
identifier = "${module.airflow_labels.id}-db"
allocated_storage = var.db_allocated_storage
max_allocated_storage = var.db_max_allocated_storage
engine = "postgres"
engine_version = "11.5"
instance_class = var.db_instance_type
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,12 @@ variable "db_allocated_storage" {
default = 20
}

variable "db_max_allocated_storage" {
description = "Specifies the value for Storage Autoscaling"
type = number
default = 0
}

variable "db_subnet_group_name" {
description = "db subnet group, if assigned, db will create in that subnet, default create in default vpc"
type = string
Expand Down
10 changes: 9 additions & 1 deletion versions.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
terraform {
required_version = ">= 0.12"
required_version = ">= 0.12.0"
required_providers {
aws = {
source = "hashicorp/aws"
}
template = {
source = "hashicorp/template"
}
}
}