forked from poush/terraform-aws-pritunl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
44 lines (34 loc) · 923 Bytes
/
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
data "aws_region" "current" {}
data "aws_caller_identity" "current" {}
data "aws_ami" "oracle" {
most_recent = true
filter {
name = "name"
values = ["OL7.6-x86_64-HVM-2019-01-29"]
}
filter {
name = "virtualization-type"
values = ["hvm"]
}
owners = ["131827586825"] # Canonical
}
resource "aws_instance" "pritunl" {
ami = data.aws_ami.oracle.id
instance_type = var.instance_type
key_name = var.aws_key_name
user_data = file("${path.module}/provision.sh")
vpc_security_group_ids = [
aws_security_group.pritunl.id,
aws_security_group.allow_from_office.id,
]
subnet_id = var.public_subnet_id
associate_public_ip_address = true
tags = merge(
map("Name", format("%s-%s", var.resource_name_prefix, "vpn")),
var.tags,
)
}
resource "aws_eip" "pritunl" {
instance = aws_instance.pritunl.id
vpc = true
}