Skip to content

Commit 4d2a042

Browse files
committed
Refactor Terraform configuration: remove ArgoCD module and related resources, streamline service definitions, and add ServiceMonitor for monitoring integration
1 parent 1432fd9 commit 4d2a042

File tree

11 files changed

+23
-283
lines changed

11 files changed

+23
-283
lines changed

Terraform/0-versions.tf

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,5 @@ terraform {
55
source = "hashicorp/aws"
66
version = "~> 5.0"
77
}
8-
helm = {
9-
source = "hashicorp/helm"
10-
version = "~> 2.12"
11-
}
12-
kubernetes = {
13-
source = "hashicorp/kubernetes"
14-
version = "~> 2.25"
15-
}
16-
time = {
17-
source = "hashicorp/time"
18-
version = "~> 0.9"
19-
}
208
}
219
}

Terraform/1-provider.tf

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,3 @@ provider "aws" {
33
region = "us-east-1"
44
}
55

6-
# Configure the Kubernetes Provider
7-
provider "kubernetes" {
8-
host = module.eks.cluster_endpoint
9-
cluster_ca_certificate = base64decode(module.eks.cluster_certificate_authority_data)
10-
11-
exec {
12-
api_version = "client.authentication.k8s.io/v1beta1"
13-
command = "aws"
14-
args = ["eks", "get-token", "--cluster-name", module.eks.cluster_name]
15-
}
16-
}
17-
18-
# Configure the Helm Provider
19-
provider "helm" {
20-
kubernetes {
21-
host = module.eks.cluster_endpoint
22-
cluster_ca_certificate = base64decode(module.eks.cluster_certificate_authority_data)
23-
24-
exec {
25-
api_version = "client.authentication.k8s.io/v1beta1"
26-
command = "aws"
27-
args = ["eks", "get-token", "--cluster-name", module.eks.cluster_name]
28-
}
29-
}
30-
}
31-

Terraform/3-main.tf

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,3 @@ module "eks" {
1717
subnet_ids = module.vpc.private_subnet_ids
1818
node_groups = var.node_groups
1919
}
20-
21-
module "argocd" {
22-
source = "./modules/argocd"
23-
24-
cluster_name = var.cluster_name
25-
namespace = "argocd"
26-
service_type = "LoadBalancer"
27-
insecure = true
28-
timeout = 600
29-
30-
applications = [
31-
{
32-
name = "solar-system"
33-
namespace = "argocd"
34-
repository_url = "https://github.com/KarimZakzouk/Graduation-Project-Devops"
35-
path = "helm"
36-
target_revision = "HEAD"
37-
destination_namespace = "default"
38-
auto_sync = true
39-
self_heal = true
40-
prune = true
41-
}
42-
]
43-
44-
depends_on = [module.eks]
45-
}

Terraform/5-outputs.tf

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,4 @@ output "cluster_endpoint" {
1111
output "cluster_name" {
1212
description = "EKS cluster name"
1313
value = module.eks.cluster_name
14-
}
15-
16-
# ArgoCD Outputs
17-
output "argocd_server_endpoint" {
18-
description = "ArgoCD server endpoint"
19-
value = module.argocd.argocd_server_endpoint
20-
}
21-
22-
output "argocd_admin_password_command" {
23-
description = "Command to get ArgoCD admin password"
24-
value = module.argocd.get_admin_password_command
2514
}

Terraform/modules/argocd/applications.tf

Lines changed: 0 additions & 57 deletions
This file was deleted.

Terraform/modules/argocd/main.tf

Lines changed: 0 additions & 55 deletions
This file was deleted.

Terraform/modules/argocd/outputs.tf

Lines changed: 0 additions & 30 deletions
This file was deleted.

Terraform/modules/argocd/variables.tf

Lines changed: 0 additions & 64 deletions
This file was deleted.

helm/templates/service.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@ apiVersion: v1
22
kind: Service
33
metadata:
44
name: {{ .Release.Name }}-svc
5+
labels:
6+
app: {{ .Release.Name }}
57
spec:
68
type: {{ .Values.service.type }}
79
ports:
8-
- port: 80
10+
- name: http
11+
port: 80
912
targetPort: {{ .Values.service.targetPort }}
1013
protocol: TCP
1114
selector:

helm/templates/servicemonitor.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: monitoring.coreos.com/v1
2+
kind: ServiceMonitor
3+
metadata:
4+
name: {{ .Release.Name }}-servicemonitor
5+
namespace: monitoring
6+
labels:
7+
release: kube-prometheus-stack
8+
spec:
9+
selector:
10+
matchLabels:
11+
app: {{ .Release.Name }}
12+
namespaceSelector:
13+
matchNames: ["default"]
14+
endpoints:
15+
- port: http
16+
path: /metrics
17+
interval: 5s
18+
scheme: http

0 commit comments

Comments
 (0)