From ed988b74448bb0d2db05886dc43a2b315cc0d717 Mon Sep 17 00:00:00 2001 From: lakshmimsft Date: Wed, 28 Feb 2024 01:02:48 -0800 Subject: [PATCH] updating per comments --- pkg/recipes/terraform/config/providers/types.go | 4 +++- pkg/recipes/terraform/config/providers/types_test.go | 2 +- .../config/testdata/providers-envrecipedefaultconfig.tf.json | 1 - 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/recipes/terraform/config/providers/types.go b/pkg/recipes/terraform/config/providers/types.go index b50abb3797..66fbf29090 100644 --- a/pkg/recipes/terraform/config/providers/types.go +++ b/pkg/recipes/terraform/config/providers/types.go @@ -58,7 +58,9 @@ func GetRecipeProviderConfigs(ctx context.Context, envConfig *recipes.Configurat // Retrieve configuration details from 'AdditionalProperties' property and add to the list. for _, configDetails := range config { - configList = append(configList, configDetails.AdditionalProperties) + if configDetails.AdditionalProperties != nil && len(configDetails.AdditionalProperties) > 0 { + configList = append(configList, configDetails.AdditionalProperties) + } } providerConfigs[provider] = configList diff --git a/pkg/recipes/terraform/config/providers/types_test.go b/pkg/recipes/terraform/config/providers/types_test.go index 67244e549f..2df4a9a4f6 100644 --- a/pkg/recipes/terraform/config/providers/types_test.go +++ b/pkg/recipes/terraform/config/providers/types_test.go @@ -53,7 +53,7 @@ func TestGetRecipeProviderConfigs(t *testing.T) { }, }, }, - expected: map[string]any{"aws": []map[string]any{map[string]any(nil)}}, + expected: map[string]any{"aws": []map[string]any{}}, }, { desc: "provider with config", diff --git a/pkg/recipes/terraform/config/testdata/providers-envrecipedefaultconfig.tf.json b/pkg/recipes/terraform/config/testdata/providers-envrecipedefaultconfig.tf.json index dc372691d7..88893b5541 100644 --- a/pkg/recipes/terraform/config/testdata/providers-envrecipedefaultconfig.tf.json +++ b/pkg/recipes/terraform/config/testdata/providers-envrecipedefaultconfig.tf.json @@ -10,7 +10,6 @@ }, "provider": { "azurerm": [ - null, { "alias": "az-paymentservice", "subscriptionid": 45678,