-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfgtvm.tf
91 lines (78 loc) · 2.29 KB
/
fgtvm.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
// FGTVM instance
resource "aws_network_interface" "eth0" {
description = "fgtvm-port1"
subnet_id = aws_subnet.publicsubnetaz1.id
}
resource "aws_network_interface" "eth1" {
description = "fgtvm-port2"
subnet_id = aws_subnet.privatesubnetaz1.id
source_dest_check = false
}
data "aws_network_interface" "eth1" {
id = aws_network_interface.eth1.id
}
//
data "aws_network_interface" "vpcendpointip" {
depends_on = [aws_vpc_endpoint.gwlbendpoint]
filter {
name = "vpc-id"
values = ["${data.aws_vpc.fgtvm-vpc.id}"]
}
filter {
name = "status"
values = ["in-use"]
}
filter {
name = "description"
values = ["*ELB*"]
}
filter {
name = "availability-zone"
values = ["${var.az1}"]
}
}
resource "aws_network_interface_sg_attachment" "publicattachment" {
depends_on = [aws_network_interface.eth0]
security_group_id = aws_security_group.public_allow.id
network_interface_id = aws_network_interface.eth0.id
}
resource "aws_network_interface_sg_attachment" "internalattachment" {
depends_on = [aws_network_interface.eth1]
security_group_id = aws_security_group.allow_all.id
network_interface_id = aws_network_interface.eth1.id
}
resource "aws_instance" "fgtvm" {
//it will use region, architect, and license type to decide which ami to use for deployment
ami = var.fgtami[var.region][var.arch][var.license_type]
instance_type = var.size
availability_zone = var.az1
key_name = var.keyname
user_data = chomp(templatefile("${var.bootstrap-fgtvm}", {
type = "${var.license_type}"
license_file = "${var.license}"
adminsport = "${var.adminsport}"
cidr = "${var.privatecidraz1}"
gateway = cidrhost(var.privatecidraz1, 1)
endpointip = "${data.aws_network_interface.vpcendpointip.private_ip}"
}))
root_block_device {
volume_type = "standard"
volume_size = "2"
}
ebs_block_device {
device_name = "/dev/sdb"
volume_size = "30"
volume_type = "standard"
}
network_interface {
network_interface_id = aws_network_interface.eth0.id
device_index = 0
}
network_interface {
network_interface_id = aws_network_interface.eth1.id
device_index = 1
}
tags = {
Name = "SDC-FGTVMA"
}
}