generated from Infrastrukturait/terraform-module-skeleton
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
85 lines (71 loc) · 2.28 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
locals {
security_group_ids = var.create_security_group ? concat(aws_security_group.this[*].id, var.additional_associated_security_group_ids) : var.associated_security_group_ids
}
resource "aws_security_group" "this" {
count = var.create_security_group ? 1 : 0
vpc_id = var.vpc_id
name = "mwaa-${var.environment_name}-no-ingress-sg"
description = var.security_group_description
tags = merge({
Name = "mwaa-${var.environment_name}-no-ingress-sg"
}, var.tags)
ingress {
from_port = 0
to_port = 0
protocol = "-1"
self = true
}
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = [
"0.0.0.0/0"
]
}
}
resource "aws_mwaa_environment" "this" {
airflow_configuration_options = var.airflow_configuration_options
execution_role_arn = aws_iam_role.this.arn
name = var.environment_name
max_workers = var.max_workers
min_workers = var.min_workers
environment_class = var.environment_class
airflow_version = var.airflow_version
source_bucket_arn = var.source_bucket_arn
dag_s3_path = var.dag_s3_path
plugins_s3_path = var.plugins_s3_path
plugins_s3_object_version = var.plugins_s3_object_version
requirements_s3_path = var.requirements_s3_path
requirements_s3_object_version = var.requirements_s3_object_version
logging_configuration {
dag_processing_logs {
enabled = var.dag_processing_logs_enabled
log_level = var.dag_processing_logs_level
}
scheduler_logs {
enabled = var.scheduler_logs_enabled
log_level = var.scheduler_logs_level
}
task_logs {
enabled = var.task_logs_enabled
log_level = var.task_logs_level
}
webserver_logs {
enabled = var.webserver_logs_enabled
log_level = var.webserver_logs_level
}
worker_logs {
enabled = var.worker_logs_enabled
log_level = var.worker_logs_level
}
}
network_configuration {
security_group_ids = local.security_group_ids
subnet_ids = var.subnet_ids
}
webserver_access_mode = var.webserver_access_mode
weekly_maintenance_window_start = var.weekly_maintenance_window_start
kms_key = var.kms_key_arn
tags = var.tags
}