Skip to content

Commit

Permalink
Update variables.
Browse files Browse the repository at this point in the history
  • Loading branch information
musa-asad committed Nov 27, 2024
1 parent 48d5038 commit f545c65
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
29 changes: 21 additions & 8 deletions terraform/e2e/eks/main.tf → terraform/eks/e2e/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ module "basic_components" {
}

locals {
aws_eks = "aws eks"
cluster_name = var.cluster_name != "" ? var.cluster_name : "cwagent-monitoring-config-e2e-eks"
}

Expand All @@ -23,8 +22,8 @@ resource "aws_eks_cluster" "this" {
role_arn = module.basic_components.role_arn
version = var.k8s_version
vpc_config {
subnet_ids = module.basic_components.public_subnet_ids
security_group_ids = [module.basic_components.security_group]
subnet_ids = module.basic_components.public_subnet_ids
security_group_ids = [module.basic_components.security_group]
}
}

Expand Down Expand Up @@ -92,12 +91,27 @@ resource "aws_iam_role_policy_attachment" "node_CloudWatchAgentServerPolicy" {
role = aws_iam_role.node_role.name
}

resource "null_resource" "helm_charts" {
provisioner "local-exec" {
command = <<-EOT
git clone https://github.com/aws-observability/helm-charts.git helm-charts
cd helm-charts
git checkout ${var.helm_charts_branch}
EOT
}

provisioner "local-exec" {
when = destroy
command = "rm -rf ${path.module}/helm-charts"
}
}

resource "null_resource" "test" {
depends_on = [aws_eks_cluster.this, aws_eks_node_group.this]
depends_on = [aws_eks_cluster.this, aws_eks_node_group.this, null_resource.helm_charts]

provisioner "local-exec" {
command = <<-EOT
go test -v ${var.validate_test} \
go test -v ${var.test_dir} \
-region=${var.region} \
-k8s_version=${var.k8s_version} \
-cluster_name=${aws_eks_cluster.this.name} \
Expand All @@ -111,8 +125,7 @@ resource "null_resource" "test" {
-agent_config=${var.agent_config} \
-otel_config=${var.otel_config} \
-prometheus_config=${var.prometheus_config} \
-sample_app=${var.sample_app} \
-sample_app_name=${var.sample_app_name}
-sample_app=${var.sample_app}
EOT
}
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ variable "k8s_version" {

variable "cluster_name" {
type = string
default = "cwagent-otel-config-e2e-eks"
default = "cwagent-monitoring-config-e2e-eks"
}

variable "helm_charts_branch" {
Expand Down Expand Up @@ -51,7 +51,7 @@ variable "cloudwatch_agent_operator_repository_url" {
default = "public.ecr.aws/cloudwatch-agent"
}

variable "validate_test" {
variable "test_dir" {
type = string
default = ""
}
Expand Down

0 comments on commit f545c65

Please sign in to comment.