diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f439440..f61691d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ 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 @@ -8,7 +8,7 @@ repos: - 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 diff --git a/README.md b/README.md index 73a956a..309ff83 100644 --- a/README.md +++ b/README.md @@ -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 | diff --git a/labels.tf b/labels.tf index f0ef4c9..58266f3 100644 --- a/labels.tf +++ b/labels.tf @@ -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" @@ -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" @@ -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" @@ -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" diff --git a/main.tf b/main.tf index ebb55a9..02ebb24 100644 --- a/main.tf +++ b/main.tf @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/variables.tf b/variables.tf index 392f8ea..8f799a1 100644 --- a/variables.tf +++ b/variables.tf @@ -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 diff --git a/versions.tf b/versions.tf index d9b6f79..d4ffad7 100644 --- a/versions.tf +++ b/versions.tf @@ -1,3 +1,11 @@ terraform { - required_version = ">= 0.12" + required_version = ">= 0.12.0" + required_providers { + aws = { + source = "hashicorp/aws" + } + template = { + source = "hashicorp/template" + } + } }