-
Notifications
You must be signed in to change notification settings - Fork 6
/
data_sync_dags.tf
34 lines (28 loc) · 1017 Bytes
/
data_sync_dags.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
resource "aws_datasync_location_s3" "dag_source" {
s3_bucket_arn = data.aws_s3_bucket.dags_bucket.arn
subdirectory = "/${var.dag_s3_key}"
s3_config {
bucket_access_role_arn = aws_iam_role.dags-datasync-task-role.arn
}
tags = var.tags
}
resource "aws_datasync_location_efs" "dag_destination" {
efs_file_system_arn = module.efs.arn
subdirectory = "/usr/local/airflow/dags"
ec2_config {
security_group_arns = [aws_security_group.sg_airflow_internal.arn]
subnet_arn = data.aws_subnet.target_mount_subnet.arn
}
}
resource "aws_datasync_task" "dag_sync" {
destination_location_arn = aws_datasync_location_efs.dag_destination.arn
name = "${var.name}-dags-delivery"
source_location_arn = aws_datasync_location_s3.dag_source.arn
options {
atime = "NONE"
bytes_per_second = -1
mtime = "NONE"
verify_mode = "ONLY_FILES_TRANSFERRED"
preserve_deleted_files = "REMOVE"
}
}