forked from sysdiglabs/terraform-aws-secure-for-cloud
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
67 lines (49 loc) · 1.85 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
#-------------------------------------
# general resources
#-------------------------------------
module "resource_group" {
source = "../../modules/infrastructure/resource-group"
name = var.name
tags = var.tags
}
module "ssm" {
source = "../../modules/infrastructure/ssm"
name = var.name
sysdig_secure_api_token = data.sysdig_secure_connection.current.secure_api_token
tags = var.tags
}
#
# scanning
#
module "codebuild" {
count = var.deploy_image_scanning_ecr || var.deploy_image_scanning_ecs ? 1 : 0
source = "../../modules/infrastructure/codebuild"
name = "${var.name}-codebuild"
secure_api_token_secret_name = module.ssm.secure_api_token_secret_name
tags = var.tags
# note. this is required to avoid racing conditions
depends_on = [module.ssm]
}
#
# threat-detection
#
module "cloud_connector" {
source = "../../modules/services/cloud-connector-ecs"
name = "${var.name}-cloudconnector"
secure_api_token_secret_name = module.ssm.secure_api_token_secret_name
deploy_image_scanning_ecr = var.deploy_image_scanning_ecr
deploy_image_scanning_ecs = var.deploy_image_scanning_ecs
is_organizational = false
build_project_arn = length(module.codebuild) == 1 ? module.codebuild[0].project_arn : "na"
build_project_name = length(module.codebuild) == 1 ? module.codebuild[0].project_name : "na"
existing_cloudtrail_config = {
cloudtrail_sns_arn = local.cloudtrail_sns_arn
}
ecs_cluster_name = local.ecs_cluster_name
ecs_vpc_id = local.ecs_vpc_id
ecs_vpc_subnets_private_ids = local.ecs_vpc_subnets_private_ids
ecs_task_cpu = var.ecs_task_cpu
ecs_task_memory = var.ecs_task_memory
tags = var.tags
depends_on = [local.cloudtrail_sns_arn, module.ssm]
}