From 05e48fba4b25027b980649ace8ffeb2cf07f15ac Mon Sep 17 00:00:00 2001 From: nikhilmulinti <127198713+nikhilmulinti@users.noreply.github.com> Date: Tue, 30 Jul 2024 12:46:50 +0530 Subject: [PATCH] updated terraform file --- infra-as-code/terraform/sample-aws/main.tf | 36 +++++++++++++++++----- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/infra-as-code/terraform/sample-aws/main.tf b/infra-as-code/terraform/sample-aws/main.tf index 1d2e8ab1..412f13eb 100644 --- a/infra-as-code/terraform/sample-aws/main.tf +++ b/infra-as-code/terraform/sample-aws/main.tf @@ -24,7 +24,7 @@ module "db" { vpc_security_group_ids = ["${module.network.rds_db_sg_id}"] availability_zone = "${element(var.availability_zones, 0)}" instance_class = "db.t3.medium" ## postgres db instance type - engine_version = "15.4" ## postgres version + engine_version = "11.22" ## postgres version storage_type = "gp2" storage_gb = "10" ## postgres disk size backup_retention_days = "7" @@ -65,7 +65,7 @@ module "eks" { ##By default worker groups is Configured with SPOT, As per your requirement you can below values. - worker_groups_launch_template = [ + worker_groups = [ { name = "spot" ami_id = "ami-01d4aea4600d4dd60" @@ -77,8 +77,6 @@ module "eks" { asg_desired_capacity = "${var.number_of_worker_nodes}" spot_allocation_strategy = "capacity-optimized" spot_instance_pools = null - launch_template_name = "${var.cluster_name}-lt" - launch_template_version = "$Latest" } ] tags = "${ @@ -117,10 +115,10 @@ resource "kubernetes_service_account" "ebs_csi_controller_sa" { name = "ebs-csi-controller-sa" namespace = "kube-system" } -} +} resource "kubernetes_annotations" "example" { - depends_on = [kubernetes_service_account.ebs_csi_controller_sa] + depends_on = [kubernetes_service_account.ebs_csi_controller_sa] api_version = "v1" kind = "ServiceAccount" metadata { @@ -137,8 +135,6 @@ resource "aws_iam_role_policy_attachment" "cluster_AmazonEBSCSIDriverPolicy" { role = module.eks.cluster_iam_role_name } - - resource "aws_iam_role_policy_attachment" "cluster_AmazonEC2FullAccess" { policy_arn = "arn:aws:iam::aws:policy/AmazonEC2FullAccess" role = "${aws_iam_role.eks_iam.name}" @@ -173,5 +169,29 @@ resource "aws_eks_addon" "core_dns" { resource "aws_eks_addon" "aws_ebs_csi_driver" { cluster_name = data.aws_eks_cluster.cluster.name addon_name = "aws-ebs-csi-driver" + addon_version = "v1.23.0-eksbuild.1" resolve_conflicts = "OVERWRITE" } + +module "es-master" { + + source = "../modules/storage/aws" + storage_count = 3 + environment = "${var.cluster_name}" + disk_prefix = "es-master" + availability_zones = "${var.availability_zones}" + storage_sku = "gp2" + disk_size_gb = "2" + +} +module "es-data-v1" { + + source = "../modules/storage/aws" + storage_count = 3 + environment = "${var.cluster_name}" + disk_prefix = "es-data-v1" + availability_zones = "${var.availability_zones}" + storage_sku = "gp2" + disk_size_gb = "25" + +} \ No newline at end of file