6767import software .amazon .awssdk .services .ecs .model .RepositoryCredentials ;
6868import software .amazon .awssdk .services .ecs .model .RunTaskResponse ;
6969import software .amazon .awssdk .services .ecs .model .RuntimePlatform ;
70+ import software .amazon .awssdk .services .ecs .model .Secret ;
7071import software .amazon .awssdk .services .ecs .model .Tag ;
7172import software .amazon .awssdk .services .ecs .model .Task ;
7273import software .amazon .awssdk .services .ecs .model .Volume ;
@@ -295,6 +296,8 @@ private String getTaskDefinition(Authentication user, ContainerSpec spec, EcsSpe
295296
296297 Pair <List <Volume >, List <MountPoint >> volumes = getVolumes (spec , specExtension );
297298
299+ List <Secret > secrets = getSecrets (spec , specExtension );
300+
298301 EphemeralStorage ephemeralStorage = EphemeralStorage
299302 .builder ()
300303 .sizeInGiB (specExtension .ecsEphemeralStorageSize .getValueOrDefault (21 ))
@@ -312,7 +315,8 @@ private String getTaskDefinition(Authentication user, ContainerSpec spec, EcsSpe
312315 .stopTimeout (2 )
313316 .dockerLabels (dockerLabels )
314317 .logConfiguration (getLogConfiguration (proxy .getSpecId ()))
315- .mountPoints (volumes .getSecond ());
318+ .mountPoints (volumes .getSecond ())
319+ .secrets (secrets );
316320
317321 String credentials = specExtension .getEcsRepositoryCredentialsParameter ().getValueOrDefault (defaultRepositoryCredentialsParameter );
318322 if (credentials != null && !credentials .isBlank ()) {
@@ -416,6 +420,17 @@ private Pair<List<Volume>, List<MountPoint>> getVolumes(ContainerSpec spec, EcsS
416420 return Pair .of (efsVolumeConfigurations , mountPoints );
417421 }
418422
423+ private List <Secret > getSecrets (ContainerSpec spec , EcsSpecExtension specExtension ) {
424+ List <Secret > secrets = new ArrayList <>();
425+ for (EcsManagedSecret managedSecrets : specExtension .getEcsManagedSecrets ()) {
426+ Secret .Builder secretBuilder = Secret .builder ();
427+ secretBuilder .name (managedSecrets .getName ().getValue ());
428+ secretBuilder .valueFrom (managedSecrets .getValueFrom ().getValue ());
429+ secrets .add (secretBuilder .build ());
430+ }
431+ return secrets ;
432+ }
433+
419434 @ Override
420435 protected void doStopProxy (Proxy proxy ) throws Exception {
421436 for (Container container : proxy .getContainers ()) {
0 commit comments