diff --git a/.gitignore b/.gitignore index 5723603..f56f6b3 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ headdesk-aws/ vsphere-yige/ anz-sandbox/ 1.SandboxTesting/ +*.tfvars diff --git a/EksIp6Nginxpod/eks-bastion.tf b/EksIp6Nginxpod/eks-bastion.tf index 69fcedb..692f486 100644 --- a/EksIp6Nginxpod/eks-bastion.tf +++ b/EksIp6Nginxpod/eks-bastion.tf @@ -1,5 +1,5 @@ module "BastionRole" { - source = "../../modules/security_identity_compliance/iam-role-v2" + source = "../modules/security_identity_compliance/iam-role-v2" description = "EKS bastion instance profile" role-name = "BastionInstanceProfile" trusted-entity = "ec2.amazonaws.com" @@ -34,7 +34,7 @@ resource "aws_iam_role_policy_attachment" "BastionProfilePermissions" { module "eks-bastion" { depends_on = [module.eks] # essential for initializing kubectl in userdata - source = "../../modules/compute/ec2" + source = "../modules/compute/ec2" additional-tags = {} ami-id = data.aws_ami.this.id @@ -46,7 +46,7 @@ module "eks-bastion" { instance-name = "${var.environment}-eks-bastion-${random_pet.pet.id}" instance-type = "t4g.micro" key-name = aws_key_pair.kp.key_name - kms-key-id = "" + kms-key-id = module.KmsKeys.cmks.storage.arn root-volume-size = "8" # security-groups = [module.bastion-sg.id, module.eks.cluster_primary_security_group_id] security-groups = [module.bastion-sg.id] @@ -121,11 +121,12 @@ resource "aws_key_pair" "kp" { } module "bastion-sg" { - source = "../../modules/compute/security_group" + source = "../modules/compute/security_group" description = "${var.environment}-eks-bastion-${random_pet.pet.id}-sg" egress = { - r1 = "-1,-1,-1,0.0.0.0/0,Allow egress" + r1 = "-1,-1,-1,0.0.0.0/0,Allow egress ipv4" + r2 = "-1,-1,-1,::/0,Allow egress ipv6" } ingress = { r1 = "tcp,22,22,0.0.0.0/0,ssh" @@ -133,14 +134,3 @@ module "bastion-sg" { name = "eks-bastion-${random_pet.pet.id}-sg" vpc-id = module.vpc.vpc_id } - -# my security_group module does not support ipv6_cidr_blocks -resource "aws_security_group_rule" "ipv6_egress" { - security_group_id = module.bastion-sg.id - type = "egress" - from_port = -1 - to_port = -1 - protocol = "all" - ipv6_cidr_blocks = ["::/0"] - description = "Allow ipv6 egress" -} \ No newline at end of file diff --git a/EksIp6Nginxpod/main.tf b/EksIp6Nginxpod/main.tf index 728aaff..0f947b6 100644 --- a/EksIp6Nginxpod/main.tf +++ b/EksIp6Nginxpod/main.tf @@ -68,39 +68,6 @@ module "vpc" { } # EKS resources -module "CsiPodIdentity" { - source = "../../modules/security_identity_compliance/iam-role-v2" - description = "EKSCSIDriverRole" - role-name = "AmazonEBSCSIDriverRole" - trusted-entity = jsonencode( - { - "Version" : "2012-10-17", - "Statement" : [ - { - "Effect" : "Allow", - "Principal" : { - "Service" : "pods.eks.amazonaws.com" - }, - "Action" : [ - "sts:AssumeRole", - "sts:TagSession" - ] - } - ] - } - ) -} - -# 2 policies are required for the ebs csi to work -resource "aws_iam_role_policy_attachment" "CsiPodIdentity" { - for_each = toset([ - "arn:aws:iam::aws:policy/AmazonEC2ReadOnlyAccess", - "arn:aws:iam::aws:policy/service-role/AmazonEBSCSIDriverPolicy" - ]) - role = module.CsiPodIdentity.name - policy_arn = each.value -} - locals { userdata = <