diff --git a/pkg/iac/adapters/cloudformation/aws/ecs/ecs_test.go b/pkg/iac/adapters/cloudformation/aws/ecs/ecs_test.go index 9cf56b0d8b6f..d1da249f7525 100644 --- a/pkg/iac/adapters/cloudformation/aws/ecs/ecs_test.go +++ b/pkg/iac/adapters/cloudformation/aws/ecs/ecs_test.go @@ -74,8 +74,8 @@ Resources: Privileged: types.BoolTest(true), Environment: []ecs.EnvVar{ { - Name: "entryPoint", - Value: "sh, -c", + Name: types.StringTest("entryPoint"), + Value: types.StringTest("sh, -c"), }, }, }, diff --git a/pkg/iac/adapters/cloudformation/aws/ecs/task_definition.go b/pkg/iac/adapters/cloudformation/aws/ecs/task_definition.go index b4cc39205147..c9b8e59a4a86 100644 --- a/pkg/iac/adapters/cloudformation/aws/ecs/task_definition.go +++ b/pkg/iac/adapters/cloudformation/aws/ecs/task_definition.go @@ -36,8 +36,8 @@ func getContainerDefinitions(r *parser.Resource) ([]ecs.ContainerDefinition, err if envVarsList.IsNotNil() && envVarsList.IsList() { for _, envVar := range envVarsList.AsList() { envVars = append(envVars, ecs.EnvVar{ - Name: envVar.GetStringProperty("Name").Value(), - Value: envVar.GetStringProperty("Value").Value(), + Name: envVar.GetStringProperty("Name"), + Value: envVar.GetStringProperty("Value"), }) } } diff --git a/pkg/iac/adapters/terraform/aws/ecs/adapt_test.go b/pkg/iac/adapters/terraform/aws/ecs/adapt_test.go index 9c70a3b1abee..412380e4d197 100644 --- a/pkg/iac/adapters/terraform/aws/ecs/adapt_test.go +++ b/pkg/iac/adapters/terraform/aws/ecs/adapt_test.go @@ -131,8 +131,8 @@ func Test_adaptTaskDefinitionResource(t *testing.T) { Privileged: iacTypes.Bool(false, iacTypes.NewTestMetadata()), Environment: []ecs.EnvVar{ { - Name: "ENVIRONMENT", - Value: "development", + Name: iacTypes.StringTest("ENVIRONMENT"), + Value: iacTypes.StringTest("development"), }, }, }, diff --git a/pkg/iac/providers/aws/ecs/ecs.go b/pkg/iac/providers/aws/ecs/ecs.go index 36e9938c80f2..661d2233b2da 100755 --- a/pkg/iac/providers/aws/ecs/ecs.go +++ b/pkg/iac/providers/aws/ecs/ecs.go @@ -69,10 +69,15 @@ func (j containerDefinitionJSON) convert(metadata iacTypes.Metadata) ContainerDe HostPort: iacTypes.Int(jMapping.HostPort, metadata), }) } + var envVars []EnvVar for _, env := range j.EnvVars { - envVars = append(envVars, EnvVar(env)) + envVars = append(envVars, EnvVar{ + Name: iacTypes.String(env.Name, metadata), + Value: iacTypes.String(env.Value, metadata), + }) } + return ContainerDefinition{ Metadata: metadata, Name: iacTypes.String(j.Name, metadata), @@ -99,8 +104,8 @@ type ContainerDefinition struct { } type EnvVar struct { - Name string - Value string + Name iacTypes.StringValue + Value iacTypes.StringValue } type PortMapping struct {