public void run() throws IOException {
        List<Stack> stacks = opsworksUtil.getStacksByName(stackName);
        if (stacks.isEmpty()) {
            throw new IllegalArgumentException("No stack found with name '" + stackName + "'");
        }

        for (Stack stack : stacks) {
            UpdateStackRequest request = new UpdateStackRequest();
            request.setStackId(stack.getStackId());

            if (customJsonOverride != null) {
                String newJson;

                ObjectMapper json = new ObjectMapper();
                json.enable(SerializationFeature.INDENT_OUTPUT);

                String oldJson = stack.getCustomJson();
                if (oldJson == null || oldJson.length() == 0) {
                    newJson = customJsonOverride;
                } else {
                    JsonNode overrideNode = json.readTree(customJsonOverride);
                    JsonNode currentNode = json.readTree(oldJson);
                    JsonNode merged = merge(currentNode, overrideNode);
                    newJson = json.writeValueAsString(merged);
                }
                request.setCustomJson(newJson);
            }
            opsworks.updateStack(request);
        }
    }