diff --git a/vpn-transit-gateway/README.md b/vpn-transit-gateway/README.md
index 179228c..7423cfa 100644
--- a/vpn-transit-gateway/README.md
+++ b/vpn-transit-gateway/README.md
@@ -95,6 +95,8 @@ No modules.
| [account\_id](#input\_account\_id) | AWS Account ID (default: will pull from current user) | `string` | `""` | no |
| [create](#input\_create) | Flag to indicate whether to create the resources or not (default: true) | `bool` | `true` | no |
| [enable\_cloudwatch\_logging](#input\_enable\_cloudwatch\_logging) | Flag to enable or disable VPN tunnel logging to CloudWatch. If Enabled, it will create the cloudwatch log groups | `bool` | `false` | no |
+| [generate\_json\_files](#input\_generate\_json\_files) | Flag to enable or disable generation of JSON file from VPN information | `bool` | `false` | no |
+| [generate\_yaml\_files](#input\_generate\_yaml\_files) | Flag to enable or disable generation of YAML file from VPN information | `bool` | `true` | no |
| [override\_prefixes](#input\_override\_prefixes) | Override built-in prefixes by component. This should be used primarily for common infrastructure things | `map(string)` | `{}` | no |
| [profile](#input\_profile) | AWS Profile Name, used for makign AWS call to download VPN configurations | `string` | `"default"` | no |
| [route\_table\_ids](#input\_route\_table\_ids) | List of created route table IDs for privating routing to be used for VPN route propagation | `list(string)` | `[]` | no |
diff --git a/vpn-transit-gateway/variables.tf b/vpn-transit-gateway/variables.tf
index 116957d..13c7676 100644
--- a/vpn-transit-gateway/variables.tf
+++ b/vpn-transit-gateway/variables.tf
@@ -66,3 +66,16 @@ variable "enable_cloudwatch_logging" {
type = bool
default = false
}
+
+variable "generate_json_files" {
+ description = "Flag to enable or disable generation of JSON file from VPN information"
+ type = bool
+ default = false
+}
+
+variable "generate_yaml_files" {
+ description = "Flag to enable or disable generation of YAML file from VPN information"
+ type = bool
+ default = true
+}
+
diff --git a/vpn-transit-gateway/vpn-config.tf b/vpn-transit-gateway/vpn-config.tf
index 2696505..226fc97 100644
--- a/vpn-transit-gateway/vpn-config.tf
+++ b/vpn-transit-gateway/vpn-config.tf
@@ -69,7 +69,7 @@ resource "null_resource" "generate_configs" {
}
resource "local_sensitive_file" "vpn_details_json" {
- for_each = local.vpn_tunnel_outputs
+ for_each = var.generate_json_files ? local.vpn_tunnel_outputs : {}
# content = templatefile("${path.module}/templates/vpn_details.tpl"), {
content = jsonencode(merge({ version = local._module_version, vpn_name = each.key }, each.value, local.vpn_tunnel_secrets[each.key]))
filename = format("%v/%v/%v.%v.%v.json", path.root, null_resource.directory_setup.triggers.name, local.account_id, local.region, each.key)
@@ -77,7 +77,7 @@ resource "local_sensitive_file" "vpn_details_json" {
}
resource "local_sensitive_file" "vpn_details_yaml" {
- for_each = local.vpn_tunnel_outputs
+ for_each = var.generate_yaml_files ? local.vpn_tunnel_outputs : {}
# content = templatefile("${path.module}/templates/vpn_details.tpl"), {
content = yamlencode(merge({ version = local._module_version, vpn_name = each.key }, each.value, local.vpn_tunnel_secrets[each.key]))
filename = format("%v/%v/%v.%v.%v.yml", path.root, null_resource.directory_setup.triggers.name, local.account_id, local.region, each.key)