From 367d9950f6602be800fd0f9abe5e2d20578dc91c Mon Sep 17 00:00:00 2001 From: sarna Date: Wed, 20 Nov 2024 16:51:13 -0800 Subject: [PATCH] Read protected file content from config --- .../nginx/nginx_configuration_resource.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/internal/services/nginx/nginx_configuration_resource.go b/internal/services/nginx/nginx_configuration_resource.go index 3242061a58904..6765466d08838 100644 --- a/internal/services/nginx/nginx_configuration_resource.go +++ b/internal/services/nginx/nginx_configuration_resource.go @@ -269,10 +269,21 @@ func (m ConfigurationResource) Read() sdk.ResourceFunc { // GET returns protected files with virtual_path only without content if files := prop.ProtectedFiles; files != nil { + configs := []ProtectedFile{} for _, file := range *files { - output.ProtectedFile = append(output.ProtectedFile, ProtectedFile{ + config := ProtectedFile{ VirtualPath: pointer.ToString(file.VirtualPath), - }) + } + for _, protectedFile := range output.ProtectedFile { + if protectedFile.VirtualPath == pointer.ToString(file.VirtualPath) { + config.Content = protectedFile.Content + break + } + } + configs = append(configs, config) + } + if len(configs) > 0 { + output.ProtectedFile = configs } } }