Skip to content

Commit

Permalink
updated terraform file
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilmulinti authored Jul 30, 2024
1 parent cb3efa5 commit 05e48fb
Showing 1 changed file with 28 additions and 8 deletions.
36 changes: 28 additions & 8 deletions infra-as-code/terraform/sample-aws/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -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 = "${
Expand Down Expand Up @@ -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 {
Expand All @@ -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}"
Expand Down Expand Up @@ -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"

}

0 comments on commit 05e48fb

Please sign in to comment.