Repository: klothoplatform/klotho (go)

Issue:
Invalid S3 Bucket Name Environment Variable
When attempting to deploy an app containing a cloud file system, an invalid bucket name environment variable is generated when the Klotho resource's ID contains invalid environment variable name characters.

This results in a failed deployment with the following error:
```
Diagnostics:
  pulumi:pulumi:Stack (DavidSeptimus-Klotho/ts-app/ds-ts-app)
    error: update failed
 
  aws:lambda:Function (executor)
    error: 1 error occurred:
	* creating Lambda Function (ts-app-executor): ValidationException: 
	status code: 400, request id: 21d4e862-1327-448e-82ff-76b82c9a72a4
```

Here's the underlying error returned by AWS when manually creating the function via the AWS CLI:

```
An error occurred (ValidationException) when calling the CreateFunction operation: 1 validation error detected: Value at 'environment.variables' failed to satisfy constraint: Map keys must satisfy constraint: [Member must satisfy regular expression pattern: [a-zA-Z]([a-zA-Z0-9_])+]
```

**Example:**

Resource:
```typescript
/**
 * @klotho::persist {
 * id = "fs-cloud"
 * }
 */
import fs = require("fs/promises");
```

Invalid environment variable:
`fs-cloud_bucket_name`


Pull request description:
make new function to use for generating env vars
• Does any part of it require special attention?
• Does it relate to or fix any issue? closes #317 

remove special characters from env var keys. Using a New method to be called which does the checks but i dont like that we cant always enforce it. Will have to be sure on code reviews

### Standard checks

- **Unit tests**: Any special considerations? updated
- **Docs**: Do we need to update any docs, internal or public? nope
- **Backwards compatibility**: Will this break existing apps? If so, what would be the extra work required to keep them working? yes


Patch:
diff --git a/pkg/core/config.go b/pkg/core/config.go
index 97a882b9..7b4b542a 100644
--- a/pkg/core/config.go
+++ b/pkg/core/config.go
@@ -1,5 +1,10 @@
 package core
 
+import (
+	"fmt"
+	"strings"
+)
+
 type (
 	Config struct {
 		Name   string
@@ -15,3 +20,7 @@ func (p *Config) Key() ResourceKey {
 		Kind: ConfigKind,
 	}
 }
+
+func GenerateSecretEnvVar(id string, kind string) environmentVariable {
+	return NewEnvironmentVariable(fmt.Sprintf("%s%s", strings.ToUpper(id), SECRET_NAME_SUFFIX), ConfigKind, id, string(SECRET_NAME))
+}
diff --git a/pkg/core/environment_variable.go b/pkg/core/environment_variable.go
index 12365e16..a74a436c 100644
--- a/pkg/core/environment_variable.go
+++ b/pkg/core/environment_variable.go
@@ -1,18 +1,54 @@
 package core
 
-import "go.uber.org/zap"
+import (
+	"github.com/klothoplatform/klotho/pkg/sanitization"
+	"go.uber.org/zap"
+)
+
+type EnvironmentVariable interface {
+	GetName() string
+	GetKind() string
+	GetResourceID() string
+	GetValue() string
+}
 
 type (
-	EnvironmentVariable struct {
+	environmentVariable struct {
 		Name       string
 		Kind       string
 		ResourceID string
 		Value      string
 	}
 
-	EnvironmentVariables []EnvironmentVariable
+	EnvironmentVariables []environmentVariable
 )
 
+func (e environmentVariable) GetName() string {
+	return e.Name
+}
+
+func (e environmentVariable) GetKind() string {
+	return e.Kind
+}
+
+func (e environmentVariable) GetResourceID() string {
+	return e.ResourceID
+}
+
+func (e environmentVariable) GetValue() string {
+	return e.Value
+}
+
+func NewEnvironmentVariable(name string, kind string, resourceId string, value string) environmentVariable {
+	name = sanitization.EnvVarKeySanitizer.Apply(name)
+	return environmentVariable{
+		Name:       name,
+		Kind:       kind,
+		ResourceID: resourceId,
+		Value:      value,
+	}
+}
+
 type EnvironmentVariableValue string
 
 const (
@@ -20,6 +56,8 @@ const (
 	ORM_ENV_VAR_NAME_SUFFIX        = "_PERSIST_ORM_CONNECTION"
 	REDIS_PORT_ENV_VAR_NAME_SUFFIX = "_PERSIST_REDIS_PORT"
 	REDIS_HOST_ENV_VAR_NAME_SUFFIX = "_PERSIST_REDIS_HOST"
+	BUCKET_NAME_SUFFIX             = "_BUCKET_NAME"
+	SECRET_NAME_SUFFIX             = "_CONFIG_SECRET"
 	KLOTHO_PROXY_ENV_VAR_NAME      = "KLOTHO_PROXY_RESOURCE_NAME"
 )
 
@@ -28,9 +66,10 @@ var (
 	PORT              EnvironmentVariableValue = "port"
 	CONNECTION_STRING EnvironmentVariableValue = "connection_string"
 	BUCKET_NAME       EnvironmentVariableValue = "bucket_name"
+	SECRET_NAME       EnvironmentVariableValue = "secret_name"
 )
 
-var InternalStorageVariable = EnvironmentVariable{
+var InternalStorageVariable = environmentVariable{
 	Name:       KLOTHO_PROXY_ENV_VAR_NAME,
 	Kind:       InternalKind,
 	ResourceID: KlothoPayloadName,
@@ -38,7 +77,7 @@ var InternalStorageVariable = EnvironmentVariable{
 }
 
 // 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) {
+func (vars *EnvironmentVariables) Add(v environmentVariable) {
 	if *vars == nil {
 		*vars = make(EnvironmentVariables, 0)
 	}
diff --git a/pkg/core/persist.go b/pkg/core/persist.go
index 8539734f..e7eea83f 100644
--- a/pkg/core/persist.go
+++ b/pkg/core/persist.go
@@ -35,29 +35,18 @@ func (p *Persist) Key() ResourceKey {
 	}
 }
 
-func GenerateRedisHostEnvVar(id string, kind string) EnvironmentVariable {
-	return EnvironmentVariable{
-		Name:       fmt.Sprintf("%s%s", strings.ToUpper(id), REDIS_HOST_ENV_VAR_NAME_SUFFIX),
-		Kind:       kind,
-		ResourceID: id,
-		Value:      string(HOST),
-	}
+func GenerateRedisHostEnvVar(id string, kind string) environmentVariable {
+	return NewEnvironmentVariable(fmt.Sprintf("%s%s", strings.ToUpper(id), REDIS_HOST_ENV_VAR_NAME_SUFFIX), kind, id, string(HOST))
 }
 
-func GenerateRedisPortEnvVar(id string, kind string) EnvironmentVariable {
-	return EnvironmentVariable{
-		Name:       fmt.Sprintf("%s%s", strings.ToUpper(id), REDIS_PORT_ENV_VAR_NAME_SUFFIX),
-		Kind:       kind,
-		ResourceID: id,
-		Value:      string(PORT),
-	}
+func GenerateRedisPortEnvVar(id string, kind string) environmentVariable {
+	return NewEnvironmentVariable(fmt.Sprintf("%s%s", strings.ToUpper(id), REDIS_PORT_ENV_VAR_NAME_SUFFIX), kind, id, string(PORT))
 }
 
-func GenerateOrmConnStringEnvVar(id string, kind string) EnvironmentVariable {
-	return EnvironmentVariable{
-		Name:       fmt.Sprintf("%s%s", strings.ToUpper(id), ORM_ENV_VAR_NAME_SUFFIX),
-		Kind:       kind,
-		ResourceID: id,
-		Value:      string(CONNECTION_STRING),
-	}
+func GenerateOrmConnStringEnvVar(id string) environmentVariable {
+	return NewEnvironmentVariable(fmt.Sprintf("%s%s", strings.ToUpper(id), ORM_ENV_VAR_NAME_SUFFIX), string(PersistORMKind), id, string(CONNECTION_STRING))
+}
+
+func GenerateBucketEnvVar(id string) environmentVariable {
+	return NewEnvironmentVariable(fmt.Sprintf("%s%s", strings.ToUpper(id), BUCKET_NAME_SUFFIX), string(PersistFileKind), id, string(BUCKET_NAME))
 }
diff --git a/pkg/env_var/plugin.go b/pkg/env_var/plugin.go
index 48d1729f..2684192a 100644
--- a/pkg/env_var/plugin.go
+++ b/pkg/env_var/plugin.go
@@ -127,12 +127,8 @@ func ParseDirectiveToEnvVars(cap *annotation.Capability) (EnvironmentVariableDir
 			return EnvironmentVariableDirectiveResult{}, errors.New("cannot have multiple resource kinds in environment variables for single annotation")
 		}
 
-		foundVariable := core.EnvironmentVariable{
-			Name:       name,
-			Kind:       kind,
-			Value:      value,
-			ResourceID: cap.ID,
-		}
+		foundVariable := core.NewEnvironmentVariable(name, kind, cap.ID, value)
+
 		foundVars.Add(foundVariable)
 	}
 
diff --git a/pkg/exec_unit/plugin_exec_unit.go b/pkg/exec_unit/plugin_exec_unit.go
index 12dfac98..fc4df80b 100644
--- a/pkg/exec_unit/plugin_exec_unit.go
+++ b/pkg/exec_unit/plugin_exec_unit.go
@@ -27,10 +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.Add(core.EnvironmentVariable{
-			Name:  key,
-			Value: value,
-		})
+		unit.EnvironmentVariables.Add(core.NewEnvironmentVariable(key, "", "", value))
 	}
 
 	for _, f := range inputR.(*core.InputFiles).Files() {
diff --git a/pkg/infra/kubernetes/persist.go b/pkg/infra/kubernetes/persist.go
index 422785a4..2834f10d 100644
--- a/pkg/infra/kubernetes/persist.go
+++ b/pkg/infra/kubernetes/persist.go
@@ -38,7 +38,7 @@ func generateEnvVars(deps *core.Dependencies, name string) core.EnvironmentVaria
 	for _, target := range deps.Downstream(core.ResourceKey{Name: name, Kind: core.ExecutionUnitKind}) {
 		switch target.Kind {
 		case string(core.PersistORMKind):
-			envVars = append(envVars, core.GenerateOrmConnStringEnvVar(target.Name, target.Kind))
+			envVars = append(envVars, core.GenerateOrmConnStringEnvVar(target.Name))
 		case string(core.PersistRedisNodeKind):
 			envVars = append(
 				envVars,
diff --git a/pkg/lang/golang/plugin_fs.go b/pkg/lang/golang/plugin_fs.go
index bfd81fe6..6d98f8b6 100644
--- a/pkg/lang/golang/plugin_fs.go
+++ b/pkg/lang/golang/plugin_fs.go
@@ -72,12 +72,7 @@ func (p *PersistFsPlugin) handleFile(f *core.SourceFile, unit *core.ExecutionUni
 
 func (p *PersistFsPlugin) transformFS(f *core.SourceFile, cap *core.Annotation, result *persistResult, unit *core.ExecutionUnit) (core.CloudResource, error) {
 
-	fsEnvVar := core.EnvironmentVariable{
-		Name:       cap.Capability.ID + "_fs_bucket",
-		Kind:       string(core.PersistFileKind),
-		ResourceID: cap.Capability.ID,
-		Value:      "bucket_url",
-	}
+	fsEnvVar := core.GenerateBucketEnvVar(cap.Capability.ID)
 
 	unit.EnvironmentVariables.Add(fsEnvVar)
 
diff --git a/pkg/lang/golang/plugin_secrets.go b/pkg/lang/golang/plugin_secrets.go
index 6a60c018..3b20ca3a 100644
--- a/pkg/lang/golang/plugin_secrets.go
+++ b/pkg/lang/golang/plugin_secrets.go
@@ -93,12 +93,8 @@ func (p *PersistSecretsPlugin) transformSecret(f *core.SourceFile, cap *core.Ann
 		queryParams = "&" + klothoRuntimePathSubChunks[1]
 	}
 	`
-	secretEnvVar := core.EnvironmentVariable{
-		Name:       cap.Capability.ID + "_config_secret",
-		Kind:       core.ConfigKind,
-		ResourceID: cap.Capability.ID,
-		Value:      "secret_name",
-	}
+	secretEnvVar := core.GenerateSecretEnvVar(cap.Capability.ID, core.ConfigKind)
+
 	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/plugin_persist.go b/pkg/lang/javascript/plugin_persist.go
index 6f3556fb..b85fe348 100644
--- a/pkg/lang/javascript/plugin_persist.go
+++ b/pkg/lang/javascript/plugin_persist.go
@@ -244,12 +244,8 @@ func (p *persister) transformFS(unit *core.ExecutionUnit, file *core.SourceFile,
 		return nil, "", errors.Wrap(err, "could not reparse FS transformation")
 	}
 
-	fsEnvVar := core.EnvironmentVariable{
-		Name:       cap.Capability.ID + "_bucket_name",
-		Kind:       string(core.PersistFileKind),
-		ResourceID: cap.Capability.ID,
-		Value:      string(core.BUCKET_NAME),
-	}
+	fsEnvVar := core.GenerateBucketEnvVar(cap.Capability.ID)
+
 	unit.EnvironmentVariables.Add(fsEnvVar)
 
 	result := &core.Persist{
@@ -286,7 +282,7 @@ func (p *persister) transformKV(file *core.SourceFile, cap *core.Annotation, kvR
 }
 
 func (p *persister) transformORM(unit *core.ExecutionUnit, file *core.SourceFile, cap *core.Annotation, ormR *persistResult) (core.CloudResource, error) {
-	envVar := core.GenerateOrmConnStringEnvVar(cap.Capability.ID, string(core.PersistORMKind))
+	envVar := core.GenerateOrmConnStringEnvVar(cap.Capability.ID)
 
 	var replaceContent string
 	switch ormR.ormType {
diff --git a/pkg/lang/python/plugin_persist.go b/pkg/lang/python/plugin_persist.go
index 43ee0b63..a36781df 100644
--- a/pkg/lang/python/plugin_persist.go
+++ b/pkg/lang/python/plugin_persist.go
@@ -246,12 +246,8 @@ func (p *persister) transformFS(original *core.SourceFile, modified *core.Source
 	if err != nil {
 		return nil, errors.Wrap(err, "could not reparse FS transformation")
 	}
-	fsEnvVar := core.EnvironmentVariable{
-		Name:       cap.Capability.ID + "_bucket_name",
-		Kind:       string(core.PersistFileKind),
-		ResourceID: cap.Capability.ID,
-		Value:      string(core.BUCKET_NAME),
-	}
+	fsEnvVar := core.GenerateBucketEnvVar(cap.Capability.ID)
+
 	unit.EnvironmentVariables.Add(fsEnvVar)
 
 	result := &core.Persist{
@@ -313,7 +309,7 @@ func (p *persister) transformORM(original *core.SourceFile, modified *core.Sourc
 	if err != nil {
 		return nil, errors.Wrap(err, "could not reparse ORM transformation")
 	}
-	envVar := core.GenerateOrmConnStringEnvVar(cap.Capability.ID, string(ormR.kind))
+	envVar := core.GenerateOrmConnStringEnvVar(cap.Capability.ID)
 
 	replaceContent := fmt.Sprintf(`os.environ.get("%s")`, envVar.Name)
 
diff --git a/pkg/sanitization/environment_variable.go b/pkg/sanitization/environment_variable.go
new file mode 100644
index 00000000..d1906743
--- /dev/null
+++ b/pkg/sanitization/environment_variable.go
@@ -0,0 +1,22 @@
+package sanitization
+
+import (
+	"regexp"
+)
+
+var EnvVarKeySanitizer = NewSanitizer(
+	// strip any leading non alpha characters
+	Rule{
+		Pattern:     regexp.MustCompile(`^[^a-zA-Z]+`),
+		Replacement: "",
+	},
+	// replace "-" or whitespace with "_"
+	Rule{
+		Pattern:     regexp.MustCompile(`[-\s]+`),
+		Replacement: "_",
+	},
+	// strip any other invalid characters
+	Rule{
+		Pattern:     regexp.MustCompile(`[^a-zA-Z0-9_]+`),
+		Replacement: "",
+	})
diff --git a/pkg/sanitization/sanitizer.go b/pkg/sanitization/sanitizer.go
new file mode 100644
index 00000000..4abdd69c
--- /dev/null
+++ b/pkg/sanitization/sanitizer.go
@@ -0,0 +1,26 @@
+package sanitization
+
+import "regexp"
+
+type (
+	Sanitizer struct {
+		rules []Rule
+	}
+
+	Rule struct {
+		Pattern     *regexp.Regexp
+		Replacement string
+	}
+)
+
+func (s *Sanitizer) Apply(input string) string {
+	output := input
+	for _, rule := range s.rules {
+		output = rule.Pattern.ReplaceAllString(output, rule.Replacement)
+	}
+	return output
+}
+
+func NewSanitizer(rules ...Rule) *Sanitizer {
+	return &Sanitizer{rules: rules}
+}


Test patch:
diff --git a/pkg/infra/kubernetes/exec_unit_test.go b/pkg/infra/kubernetes/exec_unit_test.go
index 83bd2337..fd77bb68 100644
--- a/pkg/infra/kubernetes/exec_unit_test.go
+++ b/pkg/infra/kubernetes/exec_unit_test.go
@@ -459,7 +459,7 @@ spec:
 						Kind:                "Deployment",
 						Type:                string(EnvironmentVariableTransformation),
 						Key:                 "SEQUELIZEDBPERSISTORMCONNECTION",
-						EnvironmentVariable: core.EnvironmentVariable{Name: "SEQUELIZEDB_PERSIST_ORM_CONNECTION"},
+						EnvironmentVariable: core.NewEnvironmentVariable("SEQUELIZEDB_PERSIST_ORM_CONNECTION", "", "", ""),
 					},
 				},
 				newFile: `apiVersion: apps/v1
@@ -568,7 +568,7 @@ spec:
 						Kind:                "Pod",
 						Type:                string(EnvironmentVariableTransformation),
 						Key:                 "SEQUELIZEDBPERSISTORMCONNECTION",
-						EnvironmentVariable: core.EnvironmentVariable{Name: "SEQUELIZEDB_PERSIST_ORM_CONNECTION"},
+						EnvironmentVariable: core.NewEnvironmentVariable("SEQUELIZEDB_PERSIST_ORM_CONNECTION", "", "", ""),
 					},
 				},
 				newFile: `apiVersion: v1
diff --git a/pkg/infra/kubernetes/persist_test.go b/pkg/infra/kubernetes/persist_test.go
index 90db21ec..45e8eaf5 100644
--- a/pkg/infra/kubernetes/persist_test.go
+++ b/pkg/infra/kubernetes/persist_test.go
@@ -101,7 +101,7 @@ status: {}
 						Kind:                "Deployment",
 						Type:                string(EnvironmentVariableTransformation),
 						Key:                 "UNITPERSISTORMCONNECTION",
-						EnvironmentVariable: core.EnvironmentVariable{Name: "UNIT_PERSIST_ORM_CONNECTION", Kind: "persist_orm", ResourceID: "unit", Value: "connection_string"},
+						EnvironmentVariable: core.NewEnvironmentVariable("UNIT_PERSIST_ORM_CONNECTION", "persist_orm", "unit", "connection_string"),
 					},
 				},
 			},
@@ -150,14 +150,14 @@ status: {}
 						Kind:                "Pod",
 						Type:                string(EnvironmentVariableTransformation),
 						Key:                 "UNITPERSISTREDISHOST",
-						EnvironmentVariable: core.EnvironmentVariable{Name: "UNIT_PERSIST_REDIS_HOST", Kind: "persist_redis_node", ResourceID: "unit", Value: "host"},
+						EnvironmentVariable: core.NewEnvironmentVariable("UNIT_PERSIST_REDIS_HOST", "persist_redis_node", "unit", "host"),
 					},
 					{
 						ExecUnitName:        "unit",
 						Kind:                "Pod",
 						Type:                string(EnvironmentVariableTransformation),
 						Key:                 "UNITPERSISTREDISPORT",
-						EnvironmentVariable: core.EnvironmentVariable{Name: "UNIT_PERSIST_REDIS_PORT", Kind: "persist_redis_node", ResourceID: "unit", Value: "port"},
+						EnvironmentVariable: core.NewEnvironmentVariable("UNIT_PERSIST_REDIS_PORT", "persist_redis_node", "unit", "port"),
 					},
 				},
 			},
@@ -206,14 +206,14 @@ status: {}
 						Kind:                "Pod",
 						Type:                string(EnvironmentVariableTransformation),
 						Key:                 "UNITPERSISTREDISHOST",
-						EnvironmentVariable: core.EnvironmentVariable{Name: "UNIT_PERSIST_REDIS_HOST", Kind: "persist_redis_cluster", ResourceID: "unit", Value: "host"},
+						EnvironmentVariable: core.NewEnvironmentVariable("UNIT_PERSIST_REDIS_HOST", "persist_redis_cluster", "unit", "host"),
 					},
 					{
 						ExecUnitName:        "unit",
 						Kind:                "Pod",
 						Type:                string(EnvironmentVariableTransformation),
 						Key:                 "UNITPERSISTREDISPORT",
-						EnvironmentVariable: core.EnvironmentVariable{Name: "UNIT_PERSIST_REDIS_PORT", Kind: "persist_redis_cluster", ResourceID: "unit", Value: "port"},
+						EnvironmentVariable: core.NewEnvironmentVariable("UNIT_PERSIST_REDIS_PORT", "persist_redis_cluster", "unit", "port"),
 					},
 				},
 			},
diff --git a/pkg/lang/golang/plugin_fs_test.go b/pkg/lang/golang/plugin_fs_test.go
index fc13e9ac..070cb97a 100644
--- a/pkg/lang/golang/plugin_fs_test.go
+++ b/pkg/lang/golang/plugin_fs_test.go
@@ -160,7 +160,7 @@ import (
 * }
 */
 var _ = fmt.Sprintf("file://%s", path)
-bucket, err := blob.OpenBucket(context.Background(), "s3://" + os.Getenv("test_fs_bucket") + "?region=" + os.Getenv("AWS_REGION"))
+bucket, err := blob.OpenBucket(context.Background(), "s3://" + os.Getenv("TEST_BUCKET_NAME") + "?region=" + os.Getenv("AWS_REGION"))
 `,
 			},
 		},
@@ -195,7 +195,7 @@ import (
 * }
 */
 var _ = fmt.Sprintf("file://%s", path)
-var bucket, err = blob.OpenBucket(context.Background(), "s3://" + os.Getenv("test_fs_bucket") + "?region=" + os.Getenv("AWS_REGION"))
+var bucket, err = blob.OpenBucket(context.Background(), "s3://" + os.Getenv("TEST_BUCKET_NAME") + "?region=" + os.Getenv("AWS_REGION"))
 `,
 			},
 		},
@@ -234,7 +234,7 @@ var err error
 * }
 */
 var _ = fmt.Sprintf("file://%s", path)
-bucket, err = blob.OpenBucket(context.Background(), "s3://" + os.Getenv("test_fs_bucket") + "?region=" + os.Getenv("AWS_REGION"))
+bucket, err = blob.OpenBucket(context.Background(), "s3://" + os.Getenv("TEST_BUCKET_NAME") + "?region=" + os.Getenv("AWS_REGION"))
 `,
 			},
 		},
diff --git a/pkg/lang/golang/plugin_secrets_test.go b/pkg/lang/golang/plugin_secrets_test.go
index b979c602..dfbc4660 100644
--- a/pkg/lang/golang/plugin_secrets_test.go
+++ b/pkg/lang/golang/plugin_secrets_test.go
@@ -167,7 +167,7 @@ var queryParams string
 	if len(klothoRuntimePathSubChunks) == 2 {
 		queryParams = "&" + klothoRuntimePathSubChunks[1]
 	}
-	v, err := runtimevar.OpenVariable(context.TODO(), "awssecretsmanager://" + os.Getenv("test_config_secret") + "?region=" + os.Getenv("AWS_REGION") + queryParams)
+	v, err := runtimevar.OpenVariable(context.TODO(), "awssecretsmanager://" + os.Getenv("TEST_CONFIG_SECRET") + "?region=" + os.Getenv("AWS_REGION") + queryParams)
 `,
 			},
 		},
@@ -208,7 +208,7 @@ var queryParams string
 	if len(klothoRuntimePathSubChunks) == 2 {
 		queryParams = "&" + klothoRuntimePathSubChunks[1]
 	}
-	var v, err = runtimevar.OpenVariable(context.TODO(), "awssecretsmanager://" + os.Getenv("test_config_secret") + "?region=" + os.Getenv("AWS_REGION") + queryParams)
+	var v, err = runtimevar.OpenVariable(context.TODO(), "awssecretsmanager://" + os.Getenv("TEST_CONFIG_SECRET") + "?region=" + os.Getenv("AWS_REGION") + queryParams)
 `,
 			},
 		},
@@ -253,7 +253,7 @@ var queryParams string
 	if len(klothoRuntimePathSubChunks) == 2 {
 		queryParams = "&" + klothoRuntimePathSubChunks[1]
 	}
-	v, err = runtimevar.OpenVariable(context.TODO(), "awssecretsmanager://" + os.Getenv("test_config_secret") + "?region=" + os.Getenv("AWS_REGION") + queryParams)
+	v, err = runtimevar.OpenVariable(context.TODO(), "awssecretsmanager://" + os.Getenv("TEST_CONFIG_SECRET") + "?region=" + os.Getenv("AWS_REGION") + queryParams)
 `,
 			},
 		},