hashicorp / terraform-aws-consul-lambda

This repository holds the Go code and Terraform module used for deploying Lambda registrator.
Mozilla Public License 2.0
5 stars 4 forks source link

Lambda Registrator Attempts to Create SSM Parameter that is Too Large #77

Open reskin89 opened 1 year ago

reskin89 commented 1 year ago

I'm currently running consul 1.14.7 (in the process of upgrading to 1.15.3) with the registrator and layer version 0.1.0-beta2.

I noticed SSM parameters for my lambdas weren't being created, causing a failure in the lambda ingress beta setup.

Upon investigating the debug logs of the lambda regsitrator I found:

{
    "errorMessage": "1 error occurred:\n\t* operation error SSM: PutParameter, https response error StatusCode: 400, RequestID: e0e6226a-9daf-4d1b-994b-536ab8427768, api error ValidationException: Standard tier parameters support a maximum parameter value of 4096 characters. To create a larger parameter value, upgrade the parameter to use the advanced-parameter tier. For more information, see https://docs.aws.amazon.com/systems-manager/latest/userguide/parameter-store-advanced-parameters.html\n\n",
    "errorType": "Error"
}

My TLS cert is a cert chain (length of 2 certs) so I'm wondering if that throws it over the edge, but it seems the registrator is attempting to put too much data in a single parameter, and may need to be splitting some of this up for modularity and functionality.

If there's any further detailed information you may need to deduce this please let me know.

reskin89 commented 1 year ago

I have now tested this with Consul Server 1.15.3 and Registrator Lambda Version 0.1.0-beta4 with the same result.

cthain commented 1 year ago

Thanks for the issue @reskin89. I think your assessment is correct. Lambda registrator attempts to write a single JSON-encoded secret including the service leaf cert, root CA cert, and trust domain. A large cert chain could push this over the 4K limit for a standard tier parameter.

reskin89 commented 1 year ago

Chris, I opened a PR #78 to address this. hopefully its acceptable, it was a quick update/change.