Skip to content
Merged
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
2 changes: 2 additions & 0 deletions examples/complete/fixtures.us-east-2.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ min_workers = 1

max_workers = 10

worker_replacement_strategy = "FORCED"

webserver_access_mode = "PRIVATE_ONLY"

dag_processing_logs_enabled = true
Expand Down
1 change: 1 addition & 0 deletions examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ module "mwaa" {
environment_class = var.environment_class
min_workers = var.min_workers
max_workers = var.max_workers
worker_replacement_strategy = var.worker_replacement_strategy
webserver_access_mode = var.webserver_access_mode
dag_processing_logs_enabled = var.dag_processing_logs_enabled
dag_processing_logs_level = var.dag_processing_logs_level
Expand Down
12 changes: 12 additions & 0 deletions examples/complete/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,15 @@ variable "min_workers" {
description = "The minimum number of workers that you want to run in your environment."
default = 1
}

variable "worker_replacement_strategy" {
type = string
description = "The worker replacement strategy to use when updating the environment. Valid values: `FORCED`, `GRACEFUL`. `FORCED` means Apache Airflow workers will be stopped and replaced without waiting for tasks to complete before an update. `GRACEFUL` means Apache Airflow workers will be able to complete running tasks for up to 12 hours during an update before being stopped and replaced."
default = "FORCED"

validation {
condition = contains(["FORCED", "GRACEFUL"], var.worker_replacement_strategy)
error_message = "Valid values are: `FORCED` or `GRACEFUL`."
}
}

1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ resource "aws_mwaa_environment" "default" {
kms_key = var.kms_key
max_workers = var.max_workers
min_workers = var.min_workers
worker_replacement_strategy = var.worker_replacement_strategy
min_webservers = var.environment_class == "mw1.micro" ? 1 : var.min_webservers
max_webservers = var.environment_class == "mw1.micro" ? 1 : var.max_webservers
schedulers = var.schedulers
Expand Down
11 changes: 11 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,17 @@ variable "min_workers" {
default = 1
}

variable "worker_replacement_strategy" {
type = string
description = "The worker replacement strategy to use when updating the environment. Valid values: `FORCED`, `GRACEFUL`. `FORCED` means Apache Airflow workers will be stopped and replaced without waiting for tasks to complete before an update. `GRACEFUL` means Apache Airflow workers will be able to complete running tasks for up to 12 hours during an update before being stopped and replaced."
default = null

validation {
condition = var.worker_replacement_strategy == null || contains(["FORCED", "GRACEFUL"], var.worker_replacement_strategy)
error_message = "Valid values are: `FORCED`, `GRACEFUL`, or `null`."
}
}

variable "max_webservers" {
type = number
description = "The maximum number of web servers that you want to run in your environment."
Expand Down
Loading