-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.tf
56 lines (45 loc) · 1.77 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
###########################################################
# Prerequisite
# Attach CloudWatchAgentServerPolicy to EKS nodegroup roles
###########################################################
locals {
cwagent_policy_arn = "arn:aws:iam::aws:policy/CloudWatchAgentServerPolicy"
}
resource "aws_iam_role_policy_attachment" "cwagent_server_policy" {
count = length(var.nodegroup_roles) > 0 ? length(var.nodegroup_roles) : 0
policy_arn = local.cwagent_policy_arn
role = var.nodegroup_roles[count.index]
}
########################################################
# Create Namespace
########################################################
resource "kubernetes_namespace_v1" "amazon_cloudwatch" {
metadata {
name = var.namespace
}
}
##################################################################
# CloudWatch Agent
##################################################################
module "cwagent" {
count = var.enable_cwagent ? 1 : 0
source = "./modules/cwagent"
namespace = var.namespace
cluster_name = var.cluster_name
cwagent_configmap_name = var.cwagent_configmap_name
}
##################################################################
# Fluent-Bit
##################################################################
module "fluent_bit" {
count = var.enable_fluent_bit ? 1 : 0
source = "./modules/fluent-bit"
cluster_name = var.cluster_name
aws_region = var.aws_region
namespace = var.namespace
fluent_bit_http_server = var.fluent_bit_http_server
fluent_bit_http_port = var.fluent_bit_http_port
fluent_bit_read_head = var.fluent_bit_read_head
fluent_bit_read_tail = var.fluent_bit_read_tail
fluentbit_configmap_name = var.fluentbit_configmap_name
}