feat(cloudformation): Parse secrets in ContainerDefinitions (#1874)

* feat(cloudformation): Parse secrets in ContainerDefinitions

* test(cloudformation): cover TaskDefinition creation with secrets
This commit is contained in:
Raiden van Bronkhorst authored and GitHub committed 2026-07-15 00:36:24 -04:00
1 parent eae039fbd0
commit a7d33ba885
2 files changed
+88

No files matched your search

@@ -46,6 +46,7 @@ import io.github.hectorvent.floci.services.ecs.model.LaunchType;
import io.github.hectorvent.floci.services.ecs.model.NetworkConfiguration;
import io.github.hectorvent.floci.services.ecs.model.NetworkMode;
import io.github.hectorvent.floci.services.ecs.model.PortMapping;
import io.github.hectorvent.floci.services.ecs.model.Secret;
import io.github.hectorvent.floci.services.ecs.model.TaskDefinition;
import io.github.hectorvent.floci.services.elbv2.ElbV2Service;
import io.github.hectorvent.floci.services.elbv2.model.Action;
@@ -3354,6 +3355,7 @@ public class CloudFormationResourceProvisioner {
}
def.setPortMappings(parseCfnPortMappings(item.path("PortMappings")));
def.setEnvironment(parseCfnEnvironment(item.path("Environment")));
def.setSecrets(parseCfnSecrets(item.path("Secrets")));
if (item.path("Command").isArray()) {
List<String> cmd = new ArrayList<>();
item.path("Command").forEach(c -> cmd.add(c.asText()));
@@ -3394,6 +3396,17 @@ public class CloudFormationResourceProvisioner {
return result;
}
private List<Secret> parseCfnSecrets(JsonNode node) {
List<Secret> result = new ArrayList<>();
if (node == null || !node.isArray()) {
return result;
}
for (JsonNode item : node) {
result.add(new Secret(item.path("Name").asText(), item.path("ValueFrom").asText()));
}
return result;
}
private List<EcsLoadBalancer> parseEcsLoadBalancers(JsonNode node, CloudFormationTemplateEngine engine) {
List<EcsLoadBalancer> result = new ArrayList<>();
if (node == null || node.isNull()) {