From 069dcdfcbf98edb1c459d5b0dead68c6cab96373 Mon Sep 17 00:00:00 2001 From: Chris Stephenson Date: Tue, 22 Aug 2023 15:28:08 +0200 Subject: [PATCH] fix: placeholders not replaced in resource params Signed-off-by: Chris Stephenson --- internal/humanitec/convert.go | 4 ++-- internal/humanitec/convert_test.go | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/internal/humanitec/convert.go b/internal/humanitec/convert.go index 0407963..fde1d3c 100644 --- a/internal/humanitec/convert.go +++ b/internal/humanitec/convert.go @@ -233,7 +233,7 @@ func ConvertSpec(name, envID string, spec *score.WorkloadSpec, ext *extensions.H "type": res.Type, } if len(res.Params) > 0 { - extRes["params"] = res.Params + extRes["params"] = ctx.SubstituteAll(res.Params) } externals[resName] = extRes } else if scope == "shared" { @@ -242,7 +242,7 @@ func ConvertSpec(name, envID string, spec *score.WorkloadSpec, ext *extensions.H "type": res.Type, } if len(res.Params) > 0 { - sharedRes["params"] = res.Params + sharedRes["params"] = ctx.SubstituteAll(res.Params) } shared = append(shared, humanitec.UpdateAction{ Operation: "add", diff --git a/internal/humanitec/convert_test.go b/internal/humanitec/convert_test.go index 2de91b6..ea357d0 100644 --- a/internal/humanitec/convert_test.go +++ b/internal/humanitec/convert_test.go @@ -316,6 +316,12 @@ func TestScoreConvert(t *testing.T) { }, Type: "some-type", }, + "route": { + Type: "route", + Params: map[string]interface{}{ + "host": "${resources.dns.host}", + }, + }, }, }, Extensions: &extensions.HumanitecExtensionsSpec{ @@ -410,6 +416,12 @@ func TestScoreConvert(t *testing.T) { }, }, }, + "route": map[string]interface{}{ + "type": "route", + "params": map[string]interface{}{ + "host": "${shared.dns.host}", + }, + }, }, }, },