diff options
| author | Paul Buetow <paul@buetow.org> | 2023-12-16 20:03:55 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2023-12-16 20:03:55 +0200 |
| commit | b96b46a4fc02f714b4684b0710a7448b7000d715 (patch) | |
| tree | dcf85e4b75beded2136af912fec37ad06e507334 /playground/ec2-instance-test | |
| parent | 066df3d853dd687a514f8830a2a530768943f2a2 (diff) | |
fix EFS mount.
Diffstat (limited to 'playground/ec2-instance-test')
| -rw-r--r-- | playground/ec2-instance-test/efs.tf | 10 | ||||
| -rw-r--r-- | playground/ec2-instance-test/main.tf | 5 |
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" } |
