-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathmain.tf
66 lines (54 loc) · 1.72 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
##__ ______ ____
##\ \ / / _ \ / ___|
###\ \ / /| |_) | |
####\ V / | __/| |___
#####\_/ |_| \____|
# Create a VPC to launch our instances into
resource "aws_vpc" "vpc" {
cidr_block = "${var.vpc["main"]}"
tags = "${
map(
"Name", "${var.env}-vpc",
"Environment", "${var.env}",
"kubernetes.io/cluster/${var.cluster_defaults["name"]}", "shared"
)
}"
}
# ____ ____ _____ _____ ____ _____ ____
#| _ \| _ \ / _ \ \ / /_ _| _ \| ____| _ \
#| |_) | |_) | | | \ \ / / | || | | | _| | |_) |
#| __/| _ <| |_| |\ V / | || |_| | |___| _ <
#|_| |_| \_\\___/ \_/ |___|____/|_____|_| \_\
# Specify the provider and access details
provider "aws" {
shared_credentials_file = "./credentials"
profile = "live"
region = "${var.region}"
}
# Using these data sources allows the configuration to be
# generic for any region.
data "aws_region" "current" {}
data "aws_availability_zones" "available" {}
# Not required: currently used in conjuction with using
# icanhazip.com to determine local laptop external IP
# to open EC2 Security Group access to the Kubernetes cluster.
# See laptop-external-ip.tf for additional information.
provider "http" {}
##___ ____ __ __
#|_ _| / ___| \ \ / /
##| | | | _ \ \ /\ / /
##| | | |_| | \ V V /
#|___| \____| \_/\_/
# Create an internet gateway to give our subnet access to the outside world
resource "aws_internet_gateway" "igw" {
vpc_id = "${aws_vpc.vpc.id}"
tags {
Name = "${var.env}-igw"
Environment = "${var.env}"
}
}
## keypair for ec2
resource "aws_key_pair" "eks-prod-key" {
key_name = "${var.nodes_defaults["key_name"]}"
public_key = "${file("./it-admin-key.pub")}"
}