-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvpc.tf
43 lines (34 loc) · 888 Bytes
/
vpc.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
resource "aws_vpc" "this" {
cidr_block = var.cidr_block
tags = {
Name = "Example idOS"
}
}
data "aws_availability_zones" "available" {}
locals {
vpc_az = data.aws_availability_zones.available.names[0]
}
resource "aws_subnet" "this" {
vpc_id = aws_vpc.this.id
cidr_block = var.cidr_block
availability_zone = local.vpc_az
map_public_ip_on_launch = true
}
resource "aws_internet_gateway" "this" {
vpc_id = aws_vpc.this.id
tags = {
Name = "Example idOS"
}
}
resource "aws_route_table" "this" {
vpc_id = aws_vpc.this.id
}
resource "aws_route" "igw" {
route_table_id = aws_route_table.this.id
destination_cidr_block = "0.0.0.0/0"
gateway_id = aws_internet_gateway.this.id
}
resource "aws_route_table_association" "this" {
subnet_id = aws_subnet.this.id
route_table_id = aws_route_table.this.id
}