Skip to content

Commit

Permalink
fix: template module deprecated and f5 acl name (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
argeiger authored Nov 15, 2022
1 parent 30d46cc commit b7d1d59
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 65 deletions.
48 changes: 22 additions & 26 deletions f5_config/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -52,35 +52,31 @@ EOD
reachable: false
hypervisor: kvm
EOD
template_file = file("${path.module}/user_data.yaml")
do_dec1 = var.license_type == "byol" ? chomp(local.do_byol_license) : "null"
do_dec2 = var.license_type == "regkeypool" ? chomp(local.do_regekypool) : local.do_dec1
do_local_declaration = var.license_type == "utilitypool" ? chomp(local.do_utilitypool) : local.do_dec2
}

data "template_file" "user_data" {
template = local.template_file
vars = {
tmos_admin_password = var.tmos_admin_password
configsync_interface = "1.1"
hostname = var.hostname
domain = var.domain
default_route_interface = var.default_route_interface == null ? "1.${length(var.secondary_subnets)}" : var.default_route_interface
default_route_gateway = cidrhost(var.secondary_subnets[length(var.secondary_subnets) - 1].cidr, 1)
do_local_declaration = local.do_local_declaration
do_declaration_url = var.do_declaration_url
as3_declaration_url = var.as3_declaration_url
ts_declaration_url = var.ts_declaration_url
phone_home_url = var.phone_home_url
tgactive_url = var.tgactive_url
tgstandby_url = var.tgstandby_url
tgrefresh_url = var.tgrefresh_url
template_source = var.template_source
template_version = var.template_version
zone = var.zone
vpc = var.vpc_id
app_id = var.app_id
}
user_data = templatefile("${path.module}/user_data.yaml",
{
tmos_admin_password = var.tmos_admin_password,
configsync_interface = "1.1",
hostname = var.hostname,
domain = var.domain,
default_route_interface = var.default_route_interface == null ? "1.${length(var.secondary_subnets)}" : var.default_route_interface,
default_route_gateway = cidrhost(var.secondary_subnets[length(var.secondary_subnets) - 1].cidr, 1),
do_local_declaration = local.do_local_declaration,
do_declaration_url = var.do_declaration_url,
as3_declaration_url = var.as3_declaration_url,
ts_declaration_url = var.ts_declaration_url,
phone_home_url = var.phone_home_url,
tgactive_url = var.tgactive_url,
tgstandby_url = var.tgstandby_url,
tgrefresh_url = var.tgrefresh_url,
template_source = var.template_source,
template_version = var.template_version,
zone = var.zone,
vpc = var.vpc_id,
app_id = var.app_id
})
}


Expand Down
2 changes: 1 addition & 1 deletion f5_config/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

output "user_data" {
description = "Cloud Init data for F5 instance"
value = data.template_file.user_data.rendered
value = local.user_data
}

##############################################################################
6 changes: 0 additions & 6 deletions f5_config/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
##############################################################################

terraform {
required_providers {
template = {
source = "hashicorp/template"
version = "2.2.0"
}
}
required_version = ">=1.0"
experiments = [module_variable_optional_attrs]
}
Expand Down
17 changes: 2 additions & 15 deletions module-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2381,25 +2381,12 @@
"teleport_version": "teleport_config_data"
},
"managed_resources": {},
"data_resources": {
"data.template_cloudinit_config.cloud_init": {
"mode": "data",
"type": "template_cloudinit_config",
"name": "cloud_init",
"provider": {
"name": "template"
},
"pos": {
"filename": "teleport_config/template.tf",
"line": 28
}
}
},
"data_resources": {},
"outputs": {
"cloud_init": {
"name": "cloud_init",
"description": "Description of my output",
"value": "data.template_cloudinit_config.cloud_init.rendered",
"value": "local.user_data",
"pos": {
"filename": "teleport_config/outputs.tf",
"line": 5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ output "bastion" {
]
}

output "f5_external" {
output "f5-external" {
description = "F5 external allow all"
value = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ output "value" {
for network_acl in concat(
[network],
var.use_teleport && network == var.bastion_vpc_name ? ["bastion"] : [],
var.use_f5 && network == var.vpc_list[0] ? ["f5_external"] : []
var.use_f5 && network == var.vpc_list[0] ? ["f5-external"] : []
) :
{
name = "${network_acl}-acl"
Expand Down
2 changes: 1 addition & 1 deletion teleport_config/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

output "cloud_init" {
description = "Description of my output"
value = data.template_cloudinit_config.cloud_init.rendered
value = local.user_data
}

##############################################################################
8 changes: 0 additions & 8 deletions teleport_config/template.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,4 @@ locals {
)
}

data "template_cloudinit_config" "cloud_init" {
base64_encode = false
gzip = false
part {
content = local.user_data
}
}

##############################################################################
6 changes: 0 additions & 6 deletions teleport_config/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
##############################################################################

terraform {
required_providers {
template = {
source = "hashicorp/template"
version = "2.2.0"
}
}
required_version = ">=1.0"
}

Expand Down

0 comments on commit b7d1d59

Please sign in to comment.