-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbastion.tf
48 lines (43 loc) · 1.22 KB
/
bastion.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
variable "haven_ip_address" {
type = "string"
default = "178.239.100.132/32"
}
variable "azure_vm_ip_address" {
type = "string"
default = "52.232.75.172/32"
}
resource "aws_security_group" "bastion" {
name = "${var.project}-bastion-${terraform.workspace}"
description = "Allow ssh from haven & azure dev, allow outbound"
vpc_id = "${aws_vpc.this.id}"
ingress {
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = ["${var.haven_ip_address}", "${var.azure_vm_ip_address}"]
}
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
tags = {
Name = "${var.project}-bastion-${terraform.workspace}"
project = "${var.project}"
Environment = "${terraform.workspace}"
}
}
resource "aws_instance" "bastion" {
ami = "${data.aws_ami.amazonlinux.id}"
instance_type = "t3.small"
subnet_id = "${aws_subnet.proxy_dmz_a.id}"
associate_public_ip_address = true
vpc_security_group_ids = ["${aws_security_group.bastion.id}"]
key_name = "Bastion"
tags = {
Name = "${var.project}-bastion-${terraform.workspace}"
project = "${var.project}"
Environment = "${terraform.workspace}"
}
}