From e989f802746082a9dc3e9718b7e1726187896168 Mon Sep 17 00:00:00 2001 From: wolf++ Date: Tue, 19 Dec 2023 14:32:47 -0800 Subject: [PATCH 1/6] template_file -> templatefile move away from deprecated syntax --- modules/vpn/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/vpn/main.tf b/modules/vpn/main.tf index 473138e..d7dcdfa 100644 --- a/modules/vpn/main.tf +++ b/modules/vpn/main.tf @@ -75,7 +75,7 @@ data "aws_ami" "ubuntu_20_ami" { } -data "template_file" "pritunl" { +data "templatefile" "pritunl" { template = file("${path.module}/scripts/pritunl-vpn.sh") } From 5e3b4c5c168dd44beb105b0e01e31ffd966d6cff Mon Sep 17 00:00:00 2001 From: wolf++ Date: Tue, 19 Dec 2023 14:33:26 -0800 Subject: [PATCH 2/6] template_file -> templatefile update docs to reflect syntax update --- modules/vpn/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/vpn/README.md b/modules/vpn/README.md index bf0d988..49ce716 100644 --- a/modules/vpn/README.md +++ b/modules/vpn/README.md @@ -53,7 +53,7 @@ Refer [this](https://pritunl.com/) for more information. | [aws_iam_policy.SSMManagedInstanceCore](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy) | data source | | [aws_iam_policy.SecretsManagerReadWrite](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy) | data source | | [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source | -| [template_file.pritunl](https://registry.terraform.io/providers/hashicorp/template/latest/docs/data-sources/file) | data source | +| [templatefile.pritunl](https://registry.terraform.io/providers/hashicorp/template/latest/docs/data-sources/file) | data source | ## Inputs From 9b1ba2cd53515e99b58fd3254ba381c45690d2f2 Mon Sep 17 00:00:00 2001 From: Nelson Wolf Date: Tue, 19 Dec 2023 14:44:45 -0800 Subject: [PATCH 3/6] Fix templatefile usage --- modules/vpn/main.tf | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/modules/vpn/main.tf b/modules/vpn/main.tf index d7dcdfa..7bd8875 100644 --- a/modules/vpn/main.tf +++ b/modules/vpn/main.tf @@ -75,10 +75,6 @@ data "aws_ami" "ubuntu_20_ami" { } -data "templatefile" "pritunl" { - template = file("${path.module}/scripts/pritunl-vpn.sh") -} - data "aws_region" "current" {} module "vpn_server" { @@ -91,7 +87,7 @@ module "vpn_server" { key_name = var.vpn_key_pair associate_public_ip_address = true vpc_security_group_ids = [module.security_group_vpn.security_group_id] - user_data = join("", data.template_file.pritunl[*].rendered) + user_data = templatefile("${path.module}/scripts/pritunl-vpn.sh") iam_instance_profile = join("", aws_iam_instance_profile.vpn_SSM[*].name) From 74af3c60868901d96f9b306be2a34fe58e7001b2 Mon Sep 17 00:00:00 2001 From: Nelson Wolf Date: Tue, 19 Dec 2023 14:51:21 -0800 Subject: [PATCH 4/6] Remove template dependency --- modules/vpn/versions.tf | 4 ---- 1 file changed, 4 deletions(-) diff --git a/modules/vpn/versions.tf b/modules/vpn/versions.tf index 06d32aa..d679150 100644 --- a/modules/vpn/versions.tf +++ b/modules/vpn/versions.tf @@ -5,10 +5,6 @@ terraform { source = "hashicorp/time" version = ">= 0.9.1" } - template = { - source = "hashicorp/template" - version = ">= 2.2.0" - } aws = { source = "hashicorp/aws" version = ">= 4.23" From 9ea662696f12d57c63e96e58b74d0af4bdb66f3d Mon Sep 17 00:00:00 2001 From: Nelson Wolf Date: Tue, 19 Dec 2023 14:51:55 -0800 Subject: [PATCH 5/6] Remove template from docs --- modules/vpn/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/vpn/README.md b/modules/vpn/README.md index 49ce716..804f6d5 100644 --- a/modules/vpn/README.md +++ b/modules/vpn/README.md @@ -17,7 +17,6 @@ Refer [this](https://pritunl.com/) for more information. |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | | [aws](#requirement\_aws) | >= 4.23 | -| [template](#requirement\_template) | >= 2.2.0 | | [time](#requirement\_time) | >= 0.9.1 | ## Providers From 9866453fc44ac74388abcac217057613f3bd5684 Mon Sep 17 00:00:00 2001 From: Nelson Wolf Date: Tue, 19 Dec 2023 16:45:42 -0800 Subject: [PATCH 6/6] add required arg to templatefile --- modules/vpn/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/vpn/main.tf b/modules/vpn/main.tf index 7bd8875..29ddd33 100644 --- a/modules/vpn/main.tf +++ b/modules/vpn/main.tf @@ -87,7 +87,7 @@ module "vpn_server" { key_name = var.vpn_key_pair associate_public_ip_address = true vpc_security_group_ids = [module.security_group_vpn.security_group_id] - user_data = templatefile("${path.module}/scripts/pritunl-vpn.sh") + user_data = templatefile("${path.module}/scripts/pritunl-vpn.sh", {}) iam_instance_profile = join("", aws_iam_instance_profile.vpn_SSM[*].name)