-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsecurityhub.tf
85 lines (75 loc) · 3.08 KB
/
securityhub.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
module "securityhub_eu-west-1" {
source = "./modules/securityhub"
count = contains(var.target_regions, "eu-west-1") && var.enable_securityhub ? 1 : 0
depends_on = [aws_organizations_organization.self]
enable = contains(var.target_regions, "eu-west-1") && var.enable_securityhub
providers = {
aws = aws.eu-west-1
}
account_type = var.account_type
enable_products = var.securityhub_enable_products
security_administrator_account_id = var.security_administrator_account_id
tags = var.tags
}
module "securityhub_us-east-1" {
source = "./modules/securityhub"
count = contains(var.target_regions, "us-east-1") && var.enable_securityhub ? 1 : 0
depends_on = [aws_organizations_organization.self]
enable = contains(var.target_regions, "us-east-1") && var.enable_securityhub
providers = {
aws = aws.us-east-1
}
account_type = var.account_type
enable_products = var.securityhub_enable_products
security_administrator_account_id = var.security_administrator_account_id
tags = var.tags
}
module "securityhub_us-east-2" {
source = "./modules/securityhub"
count = contains(var.target_regions, "us-east-2") && var.enable_securityhub ? 1 : 0
depends_on = [aws_organizations_organization.self]
enable = contains(var.target_regions, "us-east-2") && var.enable_securityhub
providers = {
aws = aws.us-east-2
}
account_type = var.account_type
enable_products = var.securityhub_enable_products
security_administrator_account_id = var.security_administrator_account_id
tags = var.tags
}
/*
resource "aws_organizations_organization" "default" {
count = var.enable_securityhub && var.account_type == "master" ? 1 : 0
aws_service_access_principals = ["securityhub.amazonaws.com"]
feature_set = "ALL"
}
resource "aws_securityhub_account" "default" {
count = var.enable_securityhub && var.account_type == "master" ? 1 : 0
}
resource "aws_securityhub_organization_admin_account" "default" {
count = var.enable_securityhub && var.account_type == "master" ? 1 : 0
depends_on = [aws_organizations_organization.self]
admin_account_id = var.security_administrator_account_id
}
# Auto enable security hub in organization member accounts
resource "aws_securityhub_organization_configuration" "default" {
count = var.enable_securityhub && var.account_type != "master" ? 1 : 0
auto_enable = true
}
module "securityhub" {
count = var.account_type == "administrator" ? 1 : 0
source = "cloudposse/security-hub/aws"
version = "0.9.0"
enabled = var.enable_securityhub && var.account_type == "administrator"
tags = var.tags
#create_sns_topic = true
#subscribers = {
# opsgenie = {
# protocol = "https"
# endpoint = "https://api.example.com/v1/"
# endpoint_auto_confirms = true
# raw_message_delivery = false
# }
#}
}
*/