feat: [CDE-228]: Remove raw template params from the list of final params passed to the provider. (#2452)

* feat: [CDE-228]: Remove raw template params from the list of final params passed to the provider.
pull/3545/head
Dhruv Dhruv 2024-08-09 15:49:11 +00:00 committed by Harness
parent a8ea70c96d
commit e1979c0b24
1 changed files with 11 additions and 2 deletions

View File

@ -115,10 +115,19 @@ func (i infraProvisioner) getTemplateParams(
func (i infraProvisioner) paramsFromResource(
infraProviderResource types.InfraProviderResource,
infraProvider infraprovider.InfraProvider,
) []types.InfraProviderParameter {
// NOTE: templateParamsMap is required to filter out template params since their values have already been fetched
// and we dont need the template identifiers, which are the values for template params in the resource Metadata.
templateParamsMap := make(map[string]bool)
for _, templateParam := range infraProvider.TemplateParams() {
templateParamsMap[templateParam.Name] = true
}
params := make([]types.InfraProviderParameter, 0)
for key, value := range infraProviderResource.Metadata {
if key == "" || value == "" {
if key == "" || value == "" || templateParamsMap[key] {
continue
}
params = append(params, types.InfraProviderParameter{
@ -169,7 +178,7 @@ func (i infraProvisioner) getAllParamsFromDB(
allParams = append(allParams, templateParams...)
params := i.paramsFromResource(infraProviderResource)
params := i.paramsFromResource(infraProviderResource, infraProvider)
allParams = append(allParams, params...)