From 6e49e947499a471dda4255ec820c7bdb0ae7ea93 Mon Sep 17 00:00:00 2001 From: Luca Prete Date: Tue, 21 Mar 2023 07:41:12 +0100 Subject: [PATCH] simple-nva: add ability to parse BGP configs as strings. (#1268) * Add ability to parse BGP configs as strings. * Fix var name * Refresh tfdoc --------- Co-authored-by: Luca Prete --- modules/cloud-config-container/simple-nva/README.md | 2 +- modules/cloud-config-container/simple-nva/main.tf | 3 ++- modules/cloud-config-container/simple-nva/variables.tf | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/cloud-config-container/simple-nva/README.md b/modules/cloud-config-container/simple-nva/README.md index 7eb7b4b87..08a5cd1b9 100644 --- a/modules/cloud-config-container/simple-nva/README.md +++ b/modules/cloud-config-container/simple-nva/README.md @@ -144,7 +144,7 @@ module "vm" { | [cloud_config](variables.tf#L17) | Cloud config template path. If null default will be used. | string | | null | | [enable_health_checks](variables.tf#L23) | Configures routing to enable responses to health check probes. | bool | | false | | [files](variables.tf#L29) | Map of extra files to create on the instance, path as key. Owner and permissions will use defaults if null. | map(object({…})) | | {} | -| [frr_config](variables.tf#L39) | FRR configuration for container running on the NVA. | object({…}) | | null | +| [frr_config](variables.tf#L39) | FRR configuration for container running on the NVA. | object({…}) | | null | | [optional_run_cmds](variables.tf#L84) | Optional Cloud Init run commands to execute. | list(string) | | [] | ## Outputs diff --git a/modules/cloud-config-container/simple-nva/main.tf b/modules/cloud-config-container/simple-nva/main.tf index 110983bf9..1fc1b540e 100644 --- a/modules/cloud-config-container/simple-nva/main.tf +++ b/modules/cloud-config-container/simple-nva/main.tf @@ -41,7 +41,8 @@ locals { permissions = "0744" } "/etc/frr/frr.conf" = { - content = file(var.frr_config.config_file) + # content can either be the path to the config file or the config string + content = try(file(var.frr_config.config_file), var.frr_config.config_file) owner = "root" permissions = "0744" } diff --git a/modules/cloud-config-container/simple-nva/variables.tf b/modules/cloud-config-container/simple-nva/variables.tf index 84f62f698..8ff770b2e 100644 --- a/modules/cloud-config-container/simple-nva/variables.tf +++ b/modules/cloud-config-container/simple-nva/variables.tf @@ -39,8 +39,8 @@ variable "files" { variable "frr_config" { description = "FRR configuration for container running on the NVA." type = object({ - daemons_enabled = optional(list(string)) config_file = string + daemons_enabled = optional(list(string)) }) default = null validation {