Files
floci/compatibility-tests/compat-terraform
Priamo Germosen 5ed3a8cad9 fix(rds,firehose,cognito): match AWS's real defaults so a second terraform plan reports no changes (#2420)
* fix(rds,firehose,cognito): match AWS's real defaults so a second terraform plan reports no changes

Three unrelated fields across three services all had the same shape of
bug: a value AWS defaults or fills in was never populated, so a create
(or a later describe) returned something a real AWS response never
would - applying cleanly and then drifting on every subsequent plan.

- RDS: AutoMinorVersionUpgrade was never read from CreateDBInstance or
  echoed back at all. AWS defaults it to true when omitted (confirmed
  against the CreateDBInstance API reference, whose example response
  echoes it explicitly); floci reported false/absent. Threaded the
  request parameter through to the model and the response XML,
  defaulting to true like AWS does.
- Firehose: S3BackupMode was missing from the ExtendedS3Destination
  model entirely, so describeDeliveryStream's existing applyDefaults()
  (which already backfills CompressionFormat/EncryptionConfiguration
  for exactly this reason) never touched it. Added the field and its
  "Disabled" default there.
- Cognito: DeviceConfiguration/UserPoolAddOns/EmailConfiguration all
  returned an empty JSON object when unconfigured. Reproduced against
  a live floci with the actual compat Terraform fixture and confirmed
  via re-plan: an empty object (rather than a real default or a JSON
  null) got Terraform's AWS provider to capture one shape into state
  at apply and read back a different one on refresh.
  - DeviceConfiguration/UserPoolAddOns: AWS's own docs state "a null
    value indicates you have deactivated device remembering" - matched
    that by emitting JSON null instead of {} when unconfigured (an
    earlier version of this fix filled UserPoolAddOns with
    AdvancedSecurityMode: OFF based on a doc example that turned out to
    be echoing an explicitly-set request value, not demonstrating a
    real default - caught by re-running the actual reproduction rather
    than trusting the read).
  - EmailConfiguration: defaults EmailSendingAccount to COGNITO_DEFAULT,
    matching its documented built-in-email-by-default behavior.

Verified end to end against the real compat-terraform fixture (not
just unit tests): a full `terraform apply` followed by
`terraform plan -detailed-exitcode` now exits 0 with "No changes"
across every resource in the fixture, not just these three. Widened
the "re-planning ... reports no changes" bats test from the
Application-Auto-Scaling-only subset it was scoped to (specifically to
dodge this bug) to the full configuration, per the issue's own
suggestion.

Closes #2200.

* fix(rds,firehose): propagate AutoMinorVersionUpgrade/S3BackupMode through update, not just create

Two review findings on the same class of bug this PR already fixes for
create/describe, but for the update path instead:

- ModifyDBInstance silently ignored AutoMinorVersionUpgrade - an
  explicit modify request was accepted (200) but never applied, so a
  subsequent describe kept reporting the old value. Threaded it
  through as a nullable Boolean, matching the existing
  EnableIAMDatabaseAuthentication pattern (null = not specified, so
  ModifyDBInstance's other unrelated fields aren't force-reset).
- FirehoseService#mergeDestination copied every ExtendedS3DestinationUpdate
  field except S3BackupMode, so an UpdateDestination call that changed
  it applied cleanly but the change never took.

A third finding (S3BackupMode also appears in the standard, non-extended
S3DestinationDescription shape) is real but pre-existing: Destination
already serializes the same S3Destination object under both
S3DestinationDescription and ExtendedS3DestinationDescription keys, so
CustomTimeZone and FileExtension - both extended-only fields per AWS's
S3DestinationDescription reference - already leak into the standard
shape today. Not fixing that here; it's a separate, larger change
affecting fields this PR didn't touch.

* fix(firehose): stop leaking extended-only fields into the standard S3 destination shape

S3DestinationDescription and ExtendedS3DestinationDescription shared
the same S3Destination object, so FileExtension/CustomTimeZone/
S3BackupMode - all extended-only per AWS's S3DestinationDescription
reference - leaked into the plain shape on every describe.

Added S3Destination#standardView(), a copy holding only the fields
AWS's plain shape actually has, and serve it from
getS3DestinationDescription(). ExtendedS3DestinationDescription keeps
serializing the live object with every field, as before.

The first attempt at this filtered the wrong call site: s3Destination(),
the internal accessor every FirehoseService business method uses
(object-key file extension/timezone logic, applyDefaults(), merges),
went through the same getter and got the same filtered copy - silently
dropping those three fields from all of it, including applyDefaults()
mutating a throwaway copy instead of the real stream. Repointed it to
getExtendedS3DestinationDescription() instead, which was never touched.

* fix(cognito): omit unset DeviceConfiguration/UserPoolAddOns instead of emitting JSON null

hectorvent's review: AWS's JSON protocol serializes only members with
a value provided - an unconfigured pool omits the key entirely, it
doesn't write a wire-level null. The "a null value indicates..." line
in AWS's own docs describes what a typed SDK getter returns for an
absent member, not the JSON literal.

Verified independently rather than taking either side on faith: the
Smithy awsJson1_1 protocol spec describes serializing "each member
value provided" as a JSON property (nothing for members without one),
and moto's DescribeUserPool never writes either key when unset - its
to_json() only ever adds keys present in extended_config, no
None-producing default. Switched both fields from putNull to omitting
the node.set(...) call entirely, matching how every other genuinely-
optional field in this same method is already handled.
2026-08-19 23:29:58 -05:00
..