-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
68 lines (56 loc) · 1.26 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# for my ec2 instance
resource "aws_instance" "access" {
instance_type = "t2.micro"
availability_zone = "us-east-1a"
ami = "ami-03a6eaae9938c858c"
tags = {
Name = var.instance_name
}
}
# VPC
resource "aws_vpc" "test-terraform" {
cidr_block = "10.0.0.0/16"
tags = {
Name = "testing"
}
}
# pub subnet
resource "aws_subnet" "pub_subnet" {
vpc_id = aws_vpc.test-terraform.id
cidr_block = "10.0.1.0/24"
availability_zone = "us-east-1a"
tags = {
Name = "pub for testing"
}
}
# my private subnet
resource "aws_subnet" "priv_subnet" {
vpc_id = aws_vpc.test-terraform.id
cidr_block = "10.0.2.0/24"
availability_zone = "us-east-1b"
tags = {
Name = "Priv for testing"
}
}
# security group
resource "aws_security_group" "for_public_access" {
name = "public access"
description = "Allow TLS inbound traffic"
vpc_id = aws_vpc.test-terraform.id
ingress {
description = "public access"
from_port = 443
to_port = 443
protocol = "-1"
}
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
ipv6_cidr_blocks = ["::/0"]
}
tags = {
Name = "public access"
}
}