Closed joescharf closed 4 years ago
I was going to separate out the fix for #39 and the addition of mount_points
and volumes
for #21 but I guess they're all coming through in one pull request now.
Thanks @joescharf I'll merge and tag for a new release :)
This pull request fixes issue #39 where non-awsvpc network modes will not deploy
The problem
When we aren't using awsvpc mode, we return a
ecs.NetworkConfiguration{AwsvpcConfiguration: &ecs.AwsVpcConfiguration{}}
which looks like essentially a bunch of nil structs, but we have a non nil AwsvpcConfiguration pointer field pointing to an empty AwsVpcConfiguration struct.When
NewtworkConfiguration
calls itsValidate()
method:AwsvpcConfiguration
is not nil soAwsvpcConfiguration.Validate()
is called.and
AwsvpcConfiguration.Validate()
checks for required fieldSubnets
and therefore we get the error:
Therefore instead of:
We should return a
nil
ifp.NetworkMode != ecs.NetworkModeAwsvpc
like so:So we should only pass a
NetworkConfiguration
if the networktype isawsvpc
Per this ECS API page
networkConfiguration
is not a required parameter to pass forUpdateServiceRequest()