From 19b8696a1effc7d69babf43a082a56b59b34e0bb Mon Sep 17 00:00:00 2001 From: badra001 Date: Mon, 19 Sep 2022 14:20:32 -0400 Subject: [PATCH] add yaml file too --- vpn-transit-gateway/README.md | 3 ++- vpn-transit-gateway/vpn-config.tf | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/vpn-transit-gateway/README.md b/vpn-transit-gateway/README.md index c11dc9f..4208bac 100644 --- a/vpn-transit-gateway/README.md +++ b/vpn-transit-gateway/README.md @@ -76,7 +76,8 @@ No modules. | [aws_ec2_transit_gateway_route_table_association.route_table](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ec2_transit_gateway_route_table_association) | resource | | [aws_ec2_transit_gateway_route_table_propagation.propagate](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ec2_transit_gateway_route_table_propagation) | resource | | [aws_vpn_connection.vpn](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpn_connection) | resource | -| [local_sensitive_file.vpn_details](https://registry.terraform.io/providers/hashicorp/local/latest/docs/resources/sensitive_file) | resource | +| [local_sensitive_file.vpn_details_json](https://registry.terraform.io/providers/hashicorp/local/latest/docs/resources/sensitive_file) | resource | +| [local_sensitive_file.vpn_details_yaml](https://registry.terraform.io/providers/hashicorp/local/latest/docs/resources/sensitive_file) | resource | | [null_resource.directory_setup](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource | | [null_resource.generate_configs](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource | | [random_string.tunnel_preshared_key](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/string) | resource | diff --git a/vpn-transit-gateway/vpn-config.tf b/vpn-transit-gateway/vpn-config.tf index 4afae5b..6a844e1 100644 --- a/vpn-transit-gateway/vpn-config.tf +++ b/vpn-transit-gateway/vpn-config.tf @@ -57,10 +57,18 @@ resource "null_resource" "generate_configs" { } } -resource "local_sensitive_file" "vpn_details" { +resource "local_sensitive_file" "vpn_details_json" { for_each = local.vpn_tunnel_outputs # content = templatefile("${path.module}/templates/vpn_details.tpl"), { content = jsonencode(merge({ version = local._module_version, name = each.key }, each.value)) filename = format("${path.root}/%v/%v.vpn_details.json", null_resource.directory_setup.triggers.name, each.key) file_permission = "0644" } + +resource "local_sensitive_file" "vpn_details_yaml" { + for_each = local.vpn_tunnel_outputs + # content = templatefile("${path.module}/templates/vpn_details.tpl"), { + content = yamlencode(merge({ version = local._module_version, name = each.key }, each.value)) + filename = format("${path.root}/%v/%v.vpn_details.yml", null_resource.directory_setup.triggers.name, each.key) + file_permission = "0644" +}