forked from fortinet/ibm-fortigate-terraform-deploy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
instance.tf
44 lines (37 loc) · 1.4 KB
/
instance.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 "ibm_is_ssh_key" "ssh_key" {
name = var.ssh_public_key
}
resource "ibm_is_volume" "logDisk" {
// Name must be lower case
name = "${var.cluster_name}-logdisk-${random_string.random_suffix.result}"
profile = "10iops-tier"
zone = var.zone1
}
resource "ibm_is_floating_ip" "publicip" {
name = "${var.cluster_name}-publicip-${random_string.random_suffix.result}"
target = ibm_is_instance.fgt1.primary_network_interface[0].id
}
resource "ibm_is_instance" "fgt1" {
name = "${var.cluster_name}-fortigate-${random_string.random_suffix.result}"
image = ibm_is_image.vnf_custom_image.id
profile = var.profile
primary_network_interface {
name = "${var.cluster_name}-port1-${random_string.random_suffix.result}"
subnet = data.ibm_is_subnet.subnet1.id
security_groups = [data.ibm_is_security_group.fgt_security_group.id]
}
network_interfaces {
name = "${var.cluster_name}-port2-${random_string.random_suffix.result}"
subnet = data.ibm_is_subnet.subnet2.id
security_groups = [data.ibm_is_security_group.fgt_security_group.id]
}
volumes = [ibm_is_volume.logDisk.id]
vpc = data.ibm_is_vpc.vpc1.id
zone = var.zone1
user_data = data.template_file.userdata.rendered
keys = [data.ibm_is_ssh_key.ssh_key.id]
}
// Use for bootstrapping cloud-init
data "template_file" "userdata" {
template = file(var.user_data)
}