Files
floci/docs
Allen Sanborn 94795dd67b fix(lambda): return VpcConfig, SnapStart and LoggingConfig from every read path (#2527)
* fix(lambda): return VpcConfig, SnapStart and LoggingConfig

CreateFunction and UpdateFunctionConfiguration accepted all three with a 200
and then omitted them from every read path, so a VPC-attached function read
back unattached. Terraform refreshes aws_lambda_function.vpc_config,
snap_start and logging_config on every plan, which made the resource
permanently non-converging rather than cosmetically incomplete.

VpcConfig was already stored but never serialised; SnapStart and LoggingConfig
were dropped on the floor entirely.

The response shapes are not the request shapes, per the AWS service model:

- VpcConfigResponse adds VpcId, which VpcConfig has no member for. Resolved
  from the first subnet through Ec2Service, and left off when EC2 does not
  know the subnet — Lambda still accepts unmanaged subnet ids.
- SnapStartResponse adds OptimizationStatus, which SnapStart has no member
  for. On only for a published version with ApplyOn=PublishedVersions.

SnapStart and LoggingConfig are always present in a response, as on AWS: unset
reads back as ApplyOn=None/OptimizationStatus=Off and LogFormat=Text with the
default /aws/lambda/<name> log group. LogFormat=JSON additionally returns both
log levels, defaulting to INFO. RuntimeVersionConfig is returned for managed
runtimes. All of it is carried into PublishVersion snapshots.

LoggingConfig is replaced wholesale on update rather than merged, matching AWS.
Both enums are validated against the model's enum sets before any field is
mutated, alongside the existing Layers and EFS pre-checks — updateFunction-
Configuration mutates the live store object, so a late throw would leave a
rejected update half-applied.

* fix(lambda): validate LogGroup and stop storing Text-format log levels

pgermosen's review on #2527 flagged two loose ends in LoggingConfig
handling. LogGroup accepted any non-blank string instead of AWS's
documented 1-512 character, [.\-_/#A-Za-z0-9]+ constraint. Separately,
ApplicationLogLevel and SystemLogLevel were stored regardless of
LogFormat but only ever surfaced by putLoggingConfig when the format
is JSON, so a Text-format function could accept a log level, persist
it, and never show it on any read path — the same accepted-then-
forgotten shape this PR exists to remove. applyLoggingConfig now only
keeps the levels when the resolved format is JSON, so nothing is
stored that isn't observable.

Also switches the two SnapStart integration tests off nodejs20.x,
which AWS's SnapStart guide does not support, onto java21, and adds
coverage for the LogGroup constraint, the JSON-only log level
validation errors, the VpcConfig detach path, and the parity error
wording pgermosen's review called out as unasserted.

docs/services/lambda.md is updated to describe the LogGroup
constraint and the Text-format no-op behavior.
2026-08-26 21:03:05 -04:00
..
2026-03-15 17:43:56 -05:00