File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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+
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff 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+
You can’t perform that action at this time.
0 commit comments