Skip to content

Commit

Permalink
feat: creating namespace in terraform before secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
anmolnagpal committed Dec 28, 2023
1 parent 4f1ef30 commit 69b528e
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,80 @@ resources:
# Configuration is rendered with `tpl` function, therefore you can use any Helm variables and/or templates here
config: |-
# This is the default configuration for prometheus-cloudwatch-exporter
region: eu-west-1
period_seconds: 240
region: us-east-1
metrics:
- aws_namespace: AWS/ELB
aws_metric_name: HealthyHostCount
aws_dimensions: [AvailabilityZone, LoadBalancerName]
aws_statistics: [Average]
- aws_namespace: AWS/ELB
aws_metric_name: UnHealthyHostCount
aws_dimensions: [AvailabilityZone, LoadBalancerName]
aws_statistics: [Average]
- aws_namespace: AWS/ELB
aws_metric_name: RequestCount
aws_dimensions: [AvailabilityZone, LoadBalancerName]
aws_statistics: [Sum]
- aws_namespace: AWS/ELB
aws_metric_name: Latency
aws_dimensions: [AvailabilityZone, LoadBalancerName]
aws_statistics: [Average]
- aws_namespace: AWS/ELB
aws_metric_name: SurgeQueueLength
aws_dimensions: [AvailabilityZone, LoadBalancerName]
aws_statistics: [Maximum, Sum]
- aws_dimensions:
- InstanceId
aws_metric_name: CPUUtilization
aws_namespace: AWS/EC2
aws_statistics:
- Average
aws_tag_select:
resource_type_selection: ec2:instance
resource_id_dimension: InstanceId
- aws_dimensions:
- InstanceId
aws_metric_name: NetworkIn
aws_namespace: AWS/EC2
aws_statistics:
- Average
- aws_dimensions:
- InstanceId
aws_metric_name: NetworkOut
aws_namespace: AWS/EC2
aws_statistics:
- Average
- aws_dimensions:
- InstanceId
aws_metric_name: NetworkPacketsIn
aws_namespace: AWS/EC2
aws_statistics:
- Average
- aws_dimensions:
- InstanceId
aws_metric_name: NetworkPacketsOut
aws_namespace: AWS/EC2
aws_statistics:
- Average
- aws_dimensions:
- InstanceId
aws_metric_name: DiskWriteBytes
aws_namespace: AWS/EC2
aws_statistics:
- Average
- aws_dimensions:
- InstanceId
aws_metric_name: DiskReadBytes
aws_namespace: AWS/EC2
aws_statistics:
- Average
- aws_dimensions:
- InstanceId
aws_metric_name: CPUCreditBalance
aws_namespace: AWS/EC2
aws_statistics:
- Average
- aws_dimensions:
- InstanceId
aws_metric_name: CPUCreditUsage
aws_namespace: AWS/EC2
aws_statistics:
- Average
- aws_dimensions:
- InstanceId
aws_metric_name: StatusCheckFailed
aws_namespace: AWS/EC2
aws_statistics:
- Sum
- aws_dimensions:
- InstanceId
aws_metric_name: StatusCheckFailed_Instance
aws_namespace: AWS/EC2
aws_statistics:
- Sum
- aws_dimensions:
- InstanceId
aws_metric_name: StatusCheckFailed_System
aws_namespace: AWS/EC2
aws_statistics:
- Sum
13 changes: 10 additions & 3 deletions addons/prometheus-cloudwatch-exporter/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,20 @@ module "prometheus_cloudwatch_exporter_role" {
value = local.role_name
}
]
depends_on = [kubectl_manifest.secret_manifest]
depends_on = [module.prometheus_cloudwatch_exporter_secret]
}

resource "kubernetes_namespace" "prometheus_cloudwatch_exporter_namespace" {
metadata {
name = local.default_helm_config.namespace
}
}

# Secret for AWS Authentication with cloudwatch exporter
resource "kubectl_manifest" "secret_manifest" {
count = length(var.secret_manifest)
yaml_body = file(var.secret_manifest[count.index])
count = length(var.secret_manifest)
yaml_body = file(var.secret_manifest[count.index])
depends_on = [kubernetes_namespace.prometheus_cloudwatch_exporter_namespace]
}

# Role for AWS Authentication
Expand Down

0 comments on commit 69b528e

Please sign in to comment.