diff --git a/pkg/iac/adapters/cloudformation/aws/ecs/ecs_test.go b/pkg/iac/adapters/cloudformation/aws/ecs/ecs_test.go index c6323a1df926..1007e4f28df6 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 9c2e342bb6f3..a8856eda914f 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 c35bcc12d9b1..ed53f3d4eab2 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 b0728c2bbf7f..32cc4f823565 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), @@ -101,8 +106,8 @@ type ContainerDefinition struct { } type EnvVar struct { - Name string - Value string + Name iacTypes.StringValue + Value iacTypes.StringValue } type PortMapping struct {