Repository: klothoplatform/klotho (go)

Issue:
Replace deprecated `set-output` command with environment file
## Description

In `.github/workflows/release.yaml`, `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information, see: [https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/](https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/)

Pull request:
Replace deprecated command with environment file
<!-- Describe the PR. 
• Does any part of it require special attention?
• Does it relate to or fix any issue?
-->

## Description

Resolve #288 

Update `.github/workflows/release.yaml` to use environment file instead of deprecated `set-output` command. 
For more information, see: [https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/](https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/)

I found the workflow files that use `set-output` command through the following command:

```bash
$ find . -name '*.yml' -o -name '*.yaml' | xargs egrep '\bset-output\b'
```

**AS-IS**

```yml
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)
```

**TO-BE**

```yml
run: echo VERSION=$(echo $GITHUB_REF | cut -d / -f 3) >> $GITHUB_OUTPUT
```

### Standard checks

- **Unit tests**: Any special considerations?
- **Docs**: Do we need to update any docs, internal or public?
- **Backwards compatibility**: Will this break existing apps? If so, what would be the extra work required to keep them working?


Patch:
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index 97545b20..c376e7a2 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -25,7 +25,7 @@ jobs:
 
       - name: Get the version
         id: get_version
-        run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)
+        run: echo VERSION=$(echo $GITHUB_REF | cut -d / -f 3) >> $GITHUB_OUTPUT
 
       - name: Build
         run: |
diff --git a/pkg/core/environment_variable.go b/pkg/core/environment_variable.go
index 6e6b3499..12365e16 100644
--- a/pkg/core/environment_variable.go
+++ b/pkg/core/environment_variable.go
@@ -1,5 +1,7 @@
 package core
 
+import "go.uber.org/zap"
+
 type (
 	EnvironmentVariable struct {
 		Name       string
@@ -7,6 +9,8 @@ type (
 		ResourceID string
 		Value      string
 	}
+
+	EnvironmentVariables []EnvironmentVariable
 )
 
 type EnvironmentVariableValue string
@@ -25,3 +29,34 @@ var (
 	CONNECTION_STRING EnvironmentVariableValue = "connection_string"
 	BUCKET_NAME       EnvironmentVariableValue = "bucket_name"
 )
+
+var InternalStorageVariable = EnvironmentVariable{
+	Name:       KLOTHO_PROXY_ENV_VAR_NAME,
+	Kind:       InternalKind,
+	ResourceID: KlothoPayloadName,
+	Value:      string(BUCKET_NAME),
+}
+
+// Add the given environment variable to the list. If a variable of the same name already exists, replace it.
+func (vars *EnvironmentVariables) Add(v EnvironmentVariable) {
+	if *vars == nil {
+		*vars = make(EnvironmentVariables, 0)
+	}
+	for i, e := range *vars {
+		if e.Name == v.Name {
+			if e.Value != v.Value || e.ResourceID != v.ResourceID {
+				zap.S().Debugf("Replacing variable %+v with %+v", e, v)
+			}
+			(*vars)[i] = v
+			return
+		}
+	}
+	*vars = append(*vars, v)
+}
+
+// AddAll is a convenience over `Add` to add many variables.
+func (vars *EnvironmentVariables) AddAll(vs EnvironmentVariables) {
+	for _, v := range vs {
+		vars.Add(v)
+	}
+}
diff --git a/pkg/core/exec_unit.go b/pkg/core/exec_unit.go
index b665641e..322b806e 100644
--- a/pkg/core/exec_unit.go
+++ b/pkg/core/exec_unit.go
@@ -18,7 +18,7 @@ type (
 		Name                 string
 		files                ConcurrentMap[string, File]
 		Executable           Executable
-		EnvironmentVariables []EnvironmentVariable
+		EnvironmentVariables EnvironmentVariables
 		DockerfilePath       string
 	}
 
diff --git a/pkg/env_var/plugin.go b/pkg/env_var/plugin.go
index ad8c8237..48d1729f 100644
--- a/pkg/env_var/plugin.go
+++ b/pkg/env_var/plugin.go
@@ -68,7 +68,7 @@ func (p EnvVarInjection) Transform(result *core.CompilationResult, deps *core.De
 						errs.Append(err)
 						continue
 					}
-					unit.EnvironmentVariables = append(unit.EnvironmentVariables, directiveResult.variables...)
+					unit.EnvironmentVariables.AddAll(directiveResult.variables)
 				}
 			}
 		}
@@ -88,13 +88,13 @@ func validateValue(kind string, value string) bool {
 
 type EnvironmentVariableDirectiveResult struct {
 	kind      string
-	variables []core.EnvironmentVariable
+	variables core.EnvironmentVariables
 }
 
 func ParseDirectiveToEnvVars(cap *annotation.Capability) (EnvironmentVariableDirectiveResult, error) {
 	overallKind := ""
 	envVars := cap.Directives.Object(core.EnvironmentVariableDirective)
-	foundVars := []core.EnvironmentVariable{}
+	foundVars := core.EnvironmentVariables{}
 	if envVars == nil {
 		return EnvironmentVariableDirectiveResult{}, nil
 	}
@@ -133,7 +133,7 @@ func ParseDirectiveToEnvVars(cap *annotation.Capability) (EnvironmentVariableDir
 			Value:      value,
 			ResourceID: cap.ID,
 		}
-		foundVars = append(foundVars, foundVariable)
+		foundVars.Add(foundVariable)
 	}
 
 	return EnvironmentVariableDirectiveResult{kind: overallKind, variables: foundVars}, nil
diff --git a/pkg/exec_unit/plugin_exec_unit.go b/pkg/exec_unit/plugin_exec_unit.go
index faf555b9..12dfac98 100644
--- a/pkg/exec_unit/plugin_exec_unit.go
+++ b/pkg/exec_unit/plugin_exec_unit.go
@@ -27,7 +27,7 @@ func (p ExecUnitPlugin) Transform(result *core.CompilationResult, deps *core.Dep
 	cfg := p.Config.GetExecutionUnit(unit.Name)
 
 	for key, value := range cfg.EnvironmentVariables {
-		unit.EnvironmentVariables = append(unit.EnvironmentVariables, core.EnvironmentVariable{
+		unit.EnvironmentVariables.Add(core.EnvironmentVariable{
 			Name:  key,
 			Value: value,
 		})
diff --git a/pkg/infra/kubernetes/exec_unit.go b/pkg/infra/kubernetes/exec_unit.go
index d65029a4..db492881 100644
--- a/pkg/infra/kubernetes/exec_unit.go
+++ b/pkg/infra/kubernetes/exec_unit.go
@@ -326,7 +326,7 @@ func (unit *HelmExecUnit) getServiceName() string {
 	return unit.Name
 }
 
-func (unit *HelmExecUnit) addEnvsVarToDeployment(envVars []core.EnvironmentVariable) ([]Value, error) {
+func (unit *HelmExecUnit) addEnvsVarToDeployment(envVars core.EnvironmentVariables) ([]Value, error) {
 	values := []Value{}
 
 	log := zap.L().Sugar().With(logging.FileField(unit.Deployment), zap.String("unit", unit.Name))
@@ -376,7 +376,7 @@ func (unit *HelmExecUnit) addEnvsVarToDeployment(envVars []core.EnvironmentVaria
 	return values, nil
 }
 
-func (unit *HelmExecUnit) addEnvVarToPod(envVars []core.EnvironmentVariable) ([]Value, error) {
+func (unit *HelmExecUnit) addEnvVarToPod(envVars core.EnvironmentVariables) ([]Value, error) {
 	values := []Value{}
 
 	log := zap.L().Sugar().With(logging.FileField(unit.Pod), zap.String("unit", unit.Name))
diff --git a/pkg/infra/kubernetes/persist.go b/pkg/infra/kubernetes/persist.go
index eaec78c4..422785a4 100644
--- a/pkg/infra/kubernetes/persist.go
+++ b/pkg/infra/kubernetes/persist.go
@@ -33,8 +33,8 @@ func (unit *HelmExecUnit) handlePersistForExecUnit(deps *core.Dependencies) ([]V
 	return values, nil
 }
 
-func generateEnvVars(deps *core.Dependencies, name string) []core.EnvironmentVariable {
-	envVars := []core.EnvironmentVariable{}
+func generateEnvVars(deps *core.Dependencies, name string) core.EnvironmentVariables {
+	envVars := core.EnvironmentVariables{}
 	for _, target := range deps.Downstream(core.ResourceKey{Name: name, Kind: core.ExecutionUnitKind}) {
 		switch target.Kind {
 		case string(core.PersistORMKind):
diff --git a/pkg/lang/golang/plugin_fs.go b/pkg/lang/golang/plugin_fs.go
index 301a4bde..5963a4cc 100644
--- a/pkg/lang/golang/plugin_fs.go
+++ b/pkg/lang/golang/plugin_fs.go
@@ -79,7 +79,7 @@ func (p *PersistFsPlugin) transformFS(f *core.SourceFile, cap *core.Annotation,
 		Value:      "bucket_url",
 	}
 
-	unit.EnvironmentVariables = append(unit.EnvironmentVariables, fsEnvVar)
+	unit.EnvironmentVariables.Add(fsEnvVar)
 
 	args, _ := getArguments(result.expression)
 	// Generate the new node content before replacing the node. We just set it so we can compile correctly
diff --git a/pkg/lang/golang/plugin_secrets.go b/pkg/lang/golang/plugin_secrets.go
index 4d9b384d..138f90bf 100644
--- a/pkg/lang/golang/plugin_secrets.go
+++ b/pkg/lang/golang/plugin_secrets.go
@@ -99,7 +99,7 @@ func (p *PersistSecretsPlugin) transformSecret(f *core.SourceFile, cap *core.Ann
 		ResourceID: cap.Capability.ID,
 		Value:      "secret_name",
 	}
-	unit.EnvironmentVariables = append(unit.EnvironmentVariables, secretEnvVar)
+	unit.EnvironmentVariables.Add(secretEnvVar)
 
 	args[1].Content = fmt.Sprintf(`"awssecretsmanager://" + os.Getenv("%s") + "?region=" + os.Getenv("AWS_REGION") + queryParams`, secretEnvVar.Name)
 
diff --git a/pkg/lang/javascript/aws_runtime/_emitter.ts b/pkg/lang/javascript/aws_runtime/_emitter.ts
index f7733a69..26ba0ba9 100644
--- a/pkg/lang/javascript/aws_runtime/_emitter.ts
+++ b/pkg/lang/javascript/aws_runtime/_emitter.ts
@@ -12,7 +12,7 @@ import * as crypto from 'crypto'
 import { addInflight } from './dispatcher'
 import { Readable } from 'stream'
 
-const payloadBucketPhysicalName = process.env.KLOTHO_S3_PREFIX + '{{.PayloadsBucketName}}'
+const payloadBucketPhysicalName = process.env.KLOTHO_PROXY_RESOURCE_NAME
 const appName = '{{.AppName}}'
 
 // The account-level ARN for sns. The topics must be account-wide unique
diff --git a/pkg/lang/javascript/aws_runtime/aws.go b/pkg/lang/javascript/aws_runtime/aws.go
index 739c6760..52ba06d9 100644
--- a/pkg/lang/javascript/aws_runtime/aws.go
+++ b/pkg/lang/javascript/aws_runtime/aws.go
@@ -181,6 +181,12 @@ func (r *AwsRuntime) AddRedisClusterRuntimeFiles(unit *core.ExecutionUnit) error
 }
 
 func (r *AwsRuntime) AddPubsubRuntimeFiles(unit *core.ExecutionUnit) error {
+	unit.EnvironmentVariables.Add(core.InternalStorageVariable)
+	err := r.AddFsRuntimeFiles(unit, core.InternalStorageVariable.Name, "payload")
+	if err != nil {
+		return err
+	}
+
 	return r.AddRuntimeFiles(unit, pubsubRuntimeFiles)
 }
 
@@ -198,14 +204,8 @@ func (r *AwsRuntime) AddProxyRuntimeFiles(unit *core.ExecutionUnit, proxyType st
 		proxyFile = proxyLambda
 
 		// We also need to add the Fs files because exec to exec calls in aws use s3
-		proxyEnvVar := core.EnvironmentVariable{
-			Name:       core.KLOTHO_PROXY_ENV_VAR_NAME,
-			Kind:       core.InternalKind,
-			ResourceID: core.KlothoPayloadName,
-			Value:      string(core.BUCKET_NAME),
-		}
-		unit.EnvironmentVariables = append(unit.EnvironmentVariables, proxyEnvVar)
-		err := r.AddFsRuntimeFiles(unit, proxyEnvVar.Name, "payload")
+		unit.EnvironmentVariables.Add(core.InternalStorageVariable)
+		err := r.AddFsRuntimeFiles(unit, core.InternalStorageVariable.Name, "payload")
 		if err != nil {
 			return err
 		}
@@ -232,14 +232,8 @@ func (r *AwsRuntime) AddExecRuntimeFiles(unit *core.ExecutionUnit, result *core.
 		DockerFile = dockerfileLambda
 		Dispatcher = dispatcherLambda
 
-		proxyEnvVar := core.EnvironmentVariable{
-			Name:       core.KLOTHO_PROXY_ENV_VAR_NAME,
-			Kind:       core.InternalKind,
-			ResourceID: core.KlothoPayloadName,
-			Value:      string(core.BUCKET_NAME),
-		}
-		unit.EnvironmentVariables = append(unit.EnvironmentVariables, proxyEnvVar)
-		err := r.AddFsRuntimeFiles(unit, proxyEnvVar.Name, "payload")
+		unit.EnvironmentVariables.Add(core.InternalStorageVariable)
+		err := r.AddFsRuntimeFiles(unit, core.InternalStorageVariable.Name, "payload")
 		if err != nil {
 			return err
 		}
diff --git a/pkg/lang/javascript/plugin_persist.go b/pkg/lang/javascript/plugin_persist.go
index 7344dddc..6f3556fb 100644
--- a/pkg/lang/javascript/plugin_persist.go
+++ b/pkg/lang/javascript/plugin_persist.go
@@ -250,7 +250,7 @@ func (p *persister) transformFS(unit *core.ExecutionUnit, file *core.SourceFile,
 		ResourceID: cap.Capability.ID,
 		Value:      string(core.BUCKET_NAME),
 	}
-	unit.EnvironmentVariables = append(unit.EnvironmentVariables, fsEnvVar)
+	unit.EnvironmentVariables.Add(fsEnvVar)
 
 	result := &core.Persist{
 		Kind: core.PersistFileKind,
@@ -307,7 +307,7 @@ func (p *persister) transformORM(unit *core.ExecutionUnit, file *core.SourceFile
 		Name: cap.Capability.ID,
 	}
 
-	unit.EnvironmentVariables = append(unit.EnvironmentVariables, envVar)
+	unit.EnvironmentVariables.Add(envVar)
 
 	return result, nil
 }
@@ -340,8 +340,8 @@ func (p *persister) transformRedis(unit *core.ExecutionUnit, file *core.SourceFi
 		Name: cap.Capability.ID,
 	}
 
-	unit.EnvironmentVariables = append(unit.EnvironmentVariables, hostEnvVar)
-	unit.EnvironmentVariables = append(unit.EnvironmentVariables, portEnvVar)
+	unit.EnvironmentVariables.Add(hostEnvVar)
+	unit.EnvironmentVariables.Add(portEnvVar)
 
 	return result, nil
 }
diff --git a/pkg/lang/python/aws_runtime/aws.go b/pkg/lang/python/aws_runtime/aws.go
index 8a8f5154..84d694cc 100644
--- a/pkg/lang/python/aws_runtime/aws.go
+++ b/pkg/lang/python/aws_runtime/aws.go
@@ -102,14 +102,8 @@ func (r *AwsRuntime) AddExecRuntimeFiles(unit *core.ExecutionUnit, result *core.
 		requirements = execRequirementsLambda
 
 		python.AddRequirements(unit, fsRequirements)
-		proxyEnvVar := core.EnvironmentVariable{
-			Name:       core.KLOTHO_PROXY_ENV_VAR_NAME,
-			Kind:       core.InternalKind,
-			ResourceID: core.KlothoPayloadName,
-			Value:      string(core.BUCKET_NAME),
-		}
-		unit.EnvironmentVariables = append(unit.EnvironmentVariables, proxyEnvVar)
-		err := r.AddFsRuntimeFiles(unit, proxyEnvVar.Name, "payload")
+		unit.EnvironmentVariables.Add(core.InternalStorageVariable)
+		err := r.AddFsRuntimeFiles(unit, core.InternalStorageVariable.Name, "payload")
 		if err != nil {
 			return err
 		}
@@ -262,14 +256,8 @@ func (r *AwsRuntime) AddProxyRuntimeFiles(unit *core.ExecutionUnit, proxyType st
 
 		// We also need to add the Fs files because exec to exec calls in aws use s3
 		python.AddRequirements(unit, fsRequirements)
-		proxyEnvVar := core.EnvironmentVariable{
-			Name:       core.KLOTHO_PROXY_ENV_VAR_NAME,
-			Kind:       core.InternalKind,
-			ResourceID: core.KlothoPayloadName,
-			Value:      string(core.BUCKET_NAME),
-		}
-		unit.EnvironmentVariables = append(unit.EnvironmentVariables, proxyEnvVar)
-		err := r.AddFsRuntimeFiles(unit, proxyEnvVar.Name, "payload")
+		unit.EnvironmentVariables.Add(core.InternalStorageVariable)
+		err := r.AddFsRuntimeFiles(unit, core.InternalStorageVariable.Name, "payload")
 		if err != nil {
 			return err
 		}
diff --git a/pkg/lang/python/plugin_persist.go b/pkg/lang/python/plugin_persist.go
index 67f199b8..43ee0b63 100644
--- a/pkg/lang/python/plugin_persist.go
+++ b/pkg/lang/python/plugin_persist.go
@@ -252,7 +252,7 @@ func (p *persister) transformFS(original *core.SourceFile, modified *core.Source
 		ResourceID: cap.Capability.ID,
 		Value:      string(core.BUCKET_NAME),
 	}
-	unit.EnvironmentVariables = append(unit.EnvironmentVariables, fsEnvVar)
+	unit.EnvironmentVariables.Add(fsEnvVar)
 
 	result := &core.Persist{
 		Kind: core.PersistFileKind,
@@ -337,7 +337,7 @@ func (p *persister) transformORM(original *core.SourceFile, modified *core.Sourc
 		Kind: core.PersistORMKind,
 		Name: cap.Capability.ID,
 	}
-	unit.EnvironmentVariables = append(unit.EnvironmentVariables, envVar)
+	unit.EnvironmentVariables.Add(envVar)
 
 	return result, nil
 }
@@ -406,8 +406,8 @@ func (p *persister) transformRedis(original *core.SourceFile, modified *core.Sou
 		Name: cap.Capability.ID,
 	}
 
-	unit.EnvironmentVariables = append(unit.EnvironmentVariables, hostEnvVar)
-	unit.EnvironmentVariables = append(unit.EnvironmentVariables, portEnvVar)
+	unit.EnvironmentVariables.Add(hostEnvVar)
+	unit.EnvironmentVariables.Add(portEnvVar)
 
 	return result, nil
 }
diff --git a/pkg/provider/infra_template.go b/pkg/provider/infra_template.go
index 3df9d8ca..7d44a3aa 100644
--- a/pkg/provider/infra_template.go
+++ b/pkg/provider/infra_template.go
@@ -65,7 +65,7 @@ type (
 		Schedules            []Schedule
 		HelmOptions          config.HelmChartOptions
 		Params               config.InfraParams
-		EnvironmentVariables []core.EnvironmentVariable
+		EnvironmentVariables core.EnvironmentVariables
 		DockerfilePath       string
 	}
 


Test patch:
diff --git a/pkg/env_var/plugin_test.go b/pkg/env_var/plugin_test.go
index 1df83b34..44a349fe 100644
--- a/pkg/env_var/plugin_test.go
+++ b/pkg/env_var/plugin_test.go
@@ -12,7 +12,7 @@ import (
 func Test_envVarPlugin(t *testing.T) {
 	type testResult struct {
 		resource core.CloudResource
-		envVars  []core.EnvironmentVariable
+		envVars  core.EnvironmentVariables
 	}
 	tests := []struct {
 		name    string
@@ -34,12 +34,13 @@ func Test_envVarPlugin(t *testing.T) {
 const a = 1`,
 			want: testResult{
 				resource: &core.Persist{Kind: core.PersistRedisNodeKind, Name: "myRedisNode"},
-				envVars: []core.EnvironmentVariable{{
-					Name:       "REDIS_NODE_HOST",
-					Kind:       "persist_redis_node",
-					ResourceID: "myRedisNode",
-					Value:      "host",
-				},
+				envVars: core.EnvironmentVariables{
+					{
+						Name:       "REDIS_NODE_HOST",
+						Kind:       "persist_redis_node",
+						ResourceID: "myRedisNode",
+						Value:      "host",
+					},
 					{
 						Name:       "REDIS_NODE_PORT",
 						Kind:       "persist_redis_node",
@@ -63,12 +64,13 @@ const a = 1`,
 const a = 1`,
 			want: testResult{
 				resource: &core.Persist{Kind: core.PersistRedisClusterKind, Name: "myRedisCluster"},
-				envVars: []core.EnvironmentVariable{{
-					Name:       "REDIS_HOST",
-					Kind:       "persist_redis_cluster",
-					ResourceID: "myRedisCluster",
-					Value:      "host",
-				},
+				envVars: core.EnvironmentVariables{
+					{
+						Name:       "REDIS_HOST",
+						Kind:       "persist_redis_cluster",
+						ResourceID: "myRedisCluster",
+						Value:      "host",
+					},
 					{
 						Name:       "REDIS_PORT",
 						Kind:       "persist_redis_cluster",
@@ -91,12 +93,13 @@ const a = 1`,
 const a = 1`,
 			want: testResult{
 				resource: &core.Persist{Kind: core.PersistORMKind, Name: "myOrm"},
-				envVars: []core.EnvironmentVariable{{
-					Name:       "ORM_CONNECTION_STRING",
-					Kind:       "persist_orm",
-					ResourceID: "myOrm",
-					Value:      "connection_string",
-				},
+				envVars: core.EnvironmentVariables{
+					{
+						Name:       "ORM_CONNECTION_STRING",
+						Kind:       "persist_orm",
+						ResourceID: "myOrm",
+						Value:      "connection_string",
+					},
 				},
 			},
 		},
@@ -215,12 +218,13 @@ func Test_parseDirectiveToEnvVars(t *testing.T) {
 const a = 1`,
 			want: EnvironmentVariableDirectiveResult{
 				kind: string(core.PersistRedisNodeKind),
-				variables: []core.EnvironmentVariable{{
-					Name:       "REDIS_NODE_HOST",
-					Kind:       "persist_redis_node",
-					ResourceID: "myRedisNode",
-					Value:      "host",
-				},
+				variables: core.EnvironmentVariables{
+					{
+						Name:       "REDIS_NODE_HOST",
+						Kind:       "persist_redis_node",
+						ResourceID: "myRedisNode",
+						Value:      "host",
+					},
 					{
 						Name:       "REDIS_NODE_PORT",
 						Kind:       "persist_redis_node",
diff --git a/pkg/exec_unit/plugin_exec_unit_test.go b/pkg/exec_unit/plugin_exec_unit_test.go
index 511ba82a..3a6e2c8d 100644
--- a/pkg/exec_unit/plugin_exec_unit_test.go
+++ b/pkg/exec_unit/plugin_exec_unit_test.go
@@ -13,7 +13,7 @@ func Test_environmentVarsAddedToUnit(t *testing.T) {
 	tests := []struct {
 		name         string
 		envVars      map[string]string
-		want         []core.EnvironmentVariable
+		want         core.EnvironmentVariables
 		wantExecUnit bool
 	}{
 		{
@@ -30,7 +30,7 @@ func Test_environmentVarsAddedToUnit(t *testing.T) {
 				"key1": "value1",
 				"key2": "value2",
 			},
-			want: []core.EnvironmentVariable{
+			want: core.EnvironmentVariables{
 				{
 					Name:  "key1",
 					Value: "value1",
diff --git a/pkg/infra/kubernetes/exec_unit_test.go b/pkg/infra/kubernetes/exec_unit_test.go
index 33f38813..83bd2337 100644
--- a/pkg/infra/kubernetes/exec_unit_test.go
+++ b/pkg/infra/kubernetes/exec_unit_test.go
@@ -428,7 +428,7 @@ func Test_addEnvVarToDeployment(t *testing.T) {
 	tests := []struct {
 		name    string
 		file    string
-		envVars []core.EnvironmentVariable
+		envVars core.EnvironmentVariables
 		want    result
 		wantErr bool
 	}{
@@ -451,7 +451,7 @@ spec:
       containers:
       - name: nginx
         image: nginx:1.14.2`,
-			envVars: []core.EnvironmentVariable{{Name: "SEQUELIZEDB_PERSIST_ORM_CONNECTION"}},
+			envVars: core.EnvironmentVariables{{Name: "SEQUELIZEDB_PERSIST_ORM_CONNECTION"}},
 			want: result{
 				values: []Value{
 					{
@@ -546,13 +546,13 @@ func Test_addEnvVarToPod(t *testing.T) {
 	tests := []struct {
 		name    string
 		file    string
-		envVars []core.EnvironmentVariable
+		envVars core.EnvironmentVariables
 		want    result
 		wantErr bool
 	}{
 		{
 			name:    "Basic Pod",
-			envVars: []core.EnvironmentVariable{{Name: "SEQUELIZEDB_PERSIST_ORM_CONNECTION"}},
+			envVars: core.EnvironmentVariables{{Name: "SEQUELIZEDB_PERSIST_ORM_CONNECTION"}},
 			file: `apiVersion: v1
 kind: Pod
 metadata:
diff --git a/pkg/infra/kubernetes/persist_test.go b/pkg/infra/kubernetes/persist_test.go
index 34d9078a..90db21ec 100644
--- a/pkg/infra/kubernetes/persist_test.go
+++ b/pkg/infra/kubernetes/persist_test.go
@@ -284,25 +284,25 @@ func Test_generateEnvVarsForPersist(t *testing.T) {
 		name     string
 		unit     *core.ExecutionUnit
 		resource core.CloudResource
-		values   []core.EnvironmentVariable
+		values   core.EnvironmentVariables
 	}{
 		{
 			name:     "Wrong dependencies",
 			unit:     &core.ExecutionUnit{Name: "main"},
 			resource: &core.Persist{Name: "file", Kind: core.PersistFileKind},
-			values:   []core.EnvironmentVariable{},
+			values:   core.EnvironmentVariables{},
 		},
 		{
 			name:     "orm dependency",
 			unit:     &core.ExecutionUnit{Name: "main"},
 			resource: &core.Persist{Name: "orm", Kind: core.PersistORMKind},
-			values:   []core.EnvironmentVariable{{Name: "ORM_PERSIST_ORM_CONNECTION", Kind: "persist_orm", ResourceID: "orm", Value: string(core.CONNECTION_STRING)}},
+			values:   core.EnvironmentVariables{{Name: "ORM_PERSIST_ORM_CONNECTION", Kind: "persist_orm", ResourceID: "orm", Value: string(core.CONNECTION_STRING)}},
 		},
 		{
 			name:     "redis node dependency",
 			unit:     &core.ExecutionUnit{Name: "main"},
 			resource: &core.Persist{Name: "redisNode", Kind: core.PersistRedisNodeKind},
-			values: []core.EnvironmentVariable{
+			values: core.EnvironmentVariables{
 				{Name: "REDISNODE_PERSIST_REDIS_HOST", Kind: "persist_redis_node", ResourceID: "redisNode", Value: string(core.HOST)},
 				{Name: "REDISNODE_PERSIST_REDIS_PORT", Kind: "persist_redis_node", ResourceID: "redisNode", Value: string(core.PORT)},
 			},
@@ -311,7 +311,7 @@ func Test_generateEnvVarsForPersist(t *testing.T) {
 			name:     "redis cluster dependency",
 			unit:     &core.ExecutionUnit{Name: "main"},
 			resource: &core.Persist{Name: "redisCluster", Kind: core.PersistRedisClusterKind},
-			values: []core.EnvironmentVariable{
+			values: core.EnvironmentVariables{
 				{Name: "REDISCLUSTER_PERSIST_REDIS_HOST", Kind: "persist_redis_cluster", ResourceID: "redisCluster", Value: string(core.HOST)},
 				{Name: "REDISCLUSTER_PERSIST_REDIS_PORT", Kind: "persist_redis_cluster", ResourceID: "redisCluster", Value: string(core.PORT)},
 			},
diff --git a/pkg/lang/python/plugin_persist_test.go b/pkg/lang/python/plugin_persist_test.go
index f30a0c39..b6a13a84 100644
--- a/pkg/lang/python/plugin_persist_test.go
+++ b/pkg/lang/python/plugin_persist_test.go
@@ -712,7 +712,7 @@ engine = create_engine(os.environ.get("SQLALCHEMY_PERSIST_ORM_CONNECTION"))`,
 			}
 			assert.NoError(err)
 			assert.Equal(tt.want, string(newF.Program()))
-			assert.Equal([]core.EnvironmentVariable{
+			assert.Equal(core.EnvironmentVariables{
 				{
 					Name:       "SQLALCHEMY_PERSIST_ORM_CONNECTION",
 					Kind:       string(core.PersistORMKind),
@@ -1048,7 +1048,7 @@ client = RedisCluster(host=os.environ.get("REDIS_PERSIST_REDIS_HOST"), port=os.e
 			}
 			assert.NoError(err)
 			assert.Equal(tt.want, string(newF.Program()))
-			assert.Equal([]core.EnvironmentVariable{
+			assert.Equal(core.EnvironmentVariables{
 				{
 					Name:       "REDIS_PERSIST_REDIS_HOST",
 					Kind:       string(tt.redisType),