summaryrefslogtreecommitdiff
path: root/playground/ec2-instance-test
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2023-12-16 20:03:55 +0200
committerPaul Buetow <paul@buetow.org>2023-12-16 20:03:55 +0200
commitb96b46a4fc02f714b4684b0710a7448b7000d715 (patch)
treedcf85e4b75beded2136af912fec37ad06e507334 /playground/ec2-instance-test
parent066df3d853dd687a514f8830a2a530768943f2a2 (diff)
fix EFS mount.
Diffstat (limited to 'playground/ec2-instance-test')
-rw-r--r--playground/ec2-instance-test/efs.tf10
-rw-r--r--playground/ec2-instance-test/main.tf5
2 files changed, 8 insertions, 7 deletions
diff --git a/playground/ec2-instance-test/efs.tf b/playground/ec2-instance-test/efs.tf
index fc7b916..dff8236 100644
--- a/playground/ec2-instance-test/efs.tf
+++ b/playground/ec2-instance-test/efs.tf
@@ -1,6 +1,6 @@
resource "aws_efs_file_system" "my_efs" {
creation_token = "my-efs"
- encrypted = true
+ encrypted = true
tags = {
Name = "MyEFS"
@@ -9,18 +9,18 @@ resource "aws_efs_file_system" "my_efs" {
resource "aws_efs_mount_target" "efs_mt" {
file_system_id = aws_efs_file_system.my_efs.id
- subnet_id = aws_subnet.my_public_subnet.id # Replace with your subnet ID
- security_groups = [aws_security_group.efs_sg.id] # Replace with your security group ID
+ subnet_id = aws_subnet.my_public_subnet.id # Replace with your subnet ID
+ security_groups = [aws_security_group.efs_sg.id] # Replace with your security group ID
}
resource "aws_security_group" "efs_sg" {
- vpc_id = aws_vpc.my_vpc.id # Replace with your VPC ID
+ vpc_id = aws_vpc.my_vpc.id # Replace with your VPC ID
ingress {
from_port = 2049 # NFS port
to_port = 2049
protocol = "tcp"
- cidr_blocks = ["10.0.0.0/16"] # Replace with the CIDR block of your VPC or EC2 instance subnet
+ cidr_blocks = ["10.0.1.0/24"] # Replace with the CIDR block of your VPC or EC2 instance subnet
}
egress {
diff --git a/playground/ec2-instance-test/main.tf b/playground/ec2-instance-test/main.tf
index ecce452..8768fc0 100644
--- a/playground/ec2-instance-test/main.tf
+++ b/playground/ec2-instance-test/main.tf
@@ -133,14 +133,15 @@ resource "aws_instance" "my_instance" {
instance_type = "t2.large"
key_name = aws_key_pair.id_rsa_pub.key_name
subnet_id = aws_subnet.my_public_subnet.id
+
vpc_security_group_ids = [
aws_security_group.allow_ssh.id,
aws_security_group.allow_http.id,
aws_security_group.allow_https.id,
aws_security_group.allow_outbound.id
]
- user_data = data.template_file.user_data.rendered
-
+ user_data = data.template_file.user_data.rendered
+ depends_on = [aws_efs_file_system.my_efs]
tags = {
Name = "my-instance"
}