Skip to content

Commit 888b434

Browse files
added ebs_volume and eks using module block and few other changes
1 parent 9a35120 commit 888b434

5 files changed

Lines changed: 159 additions & 0 deletions

File tree

.terraform.lock.hcl

Lines changed: 80 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ebs_volume.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
resource "aws_ebs_volume" "test_storage" {
2+
availability_zone = "us-west-2a"
3+
size = 40
4+
5+
}
6+
7+
resource "aws_volume_attachment" "ebs_att" {
8+
device_name = "/dev/sdh"
9+
volume_id = aws_ebs_volume.test_storage.id
10+
instance_id = aws_instance.testinstance.id
11+
}
12+

eks.tf

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
module "eks" {
2+
source = "terraform-aws-modules/eks/aws"
3+
version = "~> 21.0"
4+
5+
name = "example"
6+
kubernetes_version = "1.33"
7+
8+
# Optional
9+
endpoint_public_access = true
10+
11+
# Optional: Adds the current caller identity as an administrator via cluster access entry
12+
enable_cluster_creator_admin_permissions = true
13+
14+
# Create just the IAM resources for EKS Auto Mode for use with custom node pools
15+
create_auto_mode_iam_resources = true
16+
compute_config = {
17+
enabled = true
18+
}
19+
20+
vpc_id = aws_vpc.main.id
21+
subnet_ids = [
22+
aws_subnet.subnet1.id,
23+
aws_subnet.subnet2.id,
24+
aws_subnet.subnet3.id
25+
]
26+
27+
tags = {
28+
Environment = "dev"
29+
Terraform = "true"
30+
}
31+
}

outputs.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,12 @@ output "ec2_public_ip" {
2626
for k, v in aws_instance.testinstance :
2727
k => v.public_ip
2828
}
29+
}
30+
31+
32+
output "ec2_names" {
33+
value = {
34+
for k, v in aws_instance.testinstance :
35+
k => v.tags["Name"]
36+
}
2937
}

vpc.tf

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,31 @@ resource "aws_vpc" "main" {
99
}
1010
}
1111

12+
resource "aws_subnet" "subnet1" {
13+
vpc_id = aws_vpc.main.id
14+
cidr_block = "10.0.1.0/24"
15+
16+
tags = {
17+
Name = "subnet1"
18+
}
19+
}
20+
21+
resource "aws_subnet" "subnet2" {
22+
vpc_id = aws_vpc.main.id
23+
cidr_block = "10.0.1.0/24"
24+
25+
tags = {
26+
Name = "subnet2"
27+
}
28+
}
29+
30+
resource "aws_subnet" "subnet3" {
31+
vpc_id = aws_vpc.main.id
32+
cidr_block = "10.0.1.0/24"
33+
34+
tags = {
35+
Name = "subnet3"
36+
}
37+
}
38+
39+

0 commit comments

Comments
 (0)