fortinet/fortigate-terraform-deploy

license variable should be a list

Closed this issue · 1 comments

Since each FortiGate should receive it's own license file, the variable for license should be changed to a list:

// license file for the fgt
variable "licenses" {
  // Change to your own byol license file, license.lic
  type    = list(string)
  default = [ "license1.lic", "license2.lic"]
}
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.licenses[0]
    format          = "${var.license_format}"
    port1_ip        = "${var.fgtport1ip[0]}"
    port1_mask      = "${cidrnetmask(var.publiccidraz1)}"
    port2_ip        = "${var.fgtport2ip[0]}"
    port2_mask      = "${cidrnetmask(var.privatecidraz1)}"
    port3_ip        = "${var.fgtport3ip[0]}"
    port3_mask      = "${cidrnetmask(var.hasynccidraz1)}"
    adminsport      = "${var.adminsport}"
    passive_peerip  = "${var.fgt2port3ip[0]}"
    mgmt_gateway_ip = cidrhost(var.hasynccidraz1, 1)
    gateway         = cidrhost(var.privatecidraz1, 1)
    defaultgwy      = cidrhost(var.publiccidraz1, 1)
  }))

The second Fortigate should use

license_file = var.licenses[1]

fixed in PR.
#267