Repository navigation
feat(config): configuration recorder and delivery channel (#580) - #650
Merged
Merged
Conversation
AWS Config is the detective half of the control loop a consumer builds after its stacks deploy, and substrate had no plugin for it: none of the 66 services could answer "is this account being recorded, and is delivery working?". The headline behaviour is that two operations which look like they answer the same question must disagree. DescribeConfigurationRecorders reporting a recorder says nothing about whether it is recording — that is DescribeConfigurationRecorderStatus.recording — and a recorder created and never started is the most common real Config misconfiguration. A Put leaves recording false; only Start flips it. The ordering refusals make a consumer's sequencing bug observable rather than silently tolerated: Start without a channel is NoAvailableDeliveryChannelException, PutDeliveryChannel without a recorder is NoAvailableConfigurationRecorderException (checked before the bucket, so the first thing a consumer is told to fix is the first thing it must fix), and DeleteDeliveryChannel while recording is LastDeliveryChannelDeleteFailed- Exception — which is what makes a teardown-and-rebuild fixture express an ordering requirement instead of passing on a sequence AWS rejects. PutDeliveryChannel computes its S3 refusals from real S3 state, permissively: a missing bucket is NoSuchBucketException, a bucket with no policy at all is InsufficientDeliveryPolicyException, and a policy passes if any Allow statement plausibly admits Config. A shape substrate's parser cannot decode passes too — the two failure directions are not symmetric, and a wrong refusal breaks working consumer code. Three seed families cover the statuses no API call can reach, since substrate delivers nothing to S3 and so cannot produce a failed delivery. Each is applied at read time, scoped by account and Region, and validated against the model's own enum. The routing alias is the hard prerequisite: Config's target prefix is StarlingDoveService, absent from targetServiceAliases, so every SDK call fell through to "service not emulated". Without it the plugin would have been registered and unit-tested green while unreachable — what #561, #610 and #636 were — so a test asserts resolution by target prefix, host and signing name. Verified against the model rather than recalled: ConfigStreamDeliveryInfo carries lastStatusChangeTime and not the export shape's time members, and is Not_Applicable when no SNS topic is configured; the default recording group says "not the global IAM types" through includeGlobalResourceTypes false, not by synthesizing an exclusion list that Put would itself refuse. Both were caught by driving the real AWS CLI against the server. Refs #580.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First of seven PRs for #580 (AWS Config, milestone v0.101.0 "detective controls"). This one is the plan's Lane 0 + Lane 1 + Lane 2.
Why the channel ships with the recorder
The plan had these as PRs 1 and 2.
StartConfigurationRecorderrefuses without a delivery channel, so a recorder-only PR could never reachrecording: true— the release's headline behaviour — leaving it untestable. They land together.What this does
Two operations that look like they answer the same question now disagree.
DescribeConfigurationRecordersreporting a recorder says nothing about whether it is recording; that isDescribeConfigurationRecorderStatus.recording. A recorder created and never started is the most common real Config misconfiguration, and a consumer checking only the first call reports an account as covered when nothing is recorded. APutleavesrecording: false; onlyStartflips it.The ordering refusals make a sequencing bug observable:
NoAvailableDeliveryChannelExceptiononStartwithout a channel,NoAvailableConfigurationRecorderExceptiononPutDeliveryChannelwithout a recorder (checked before the bucket, per the operation's own ordering), andLastDeliveryChannelDeleteFailedExceptionon a delete while recording — which is what makes a teardown-and-rebuild fixture express an ordering requirement rather than pass on a sequence AWS rejects.PutDeliveryChannelcomputes its S3 refusals from real S3 state, permissively. Missing bucket →NoSuchBucketException; bucket with no policy at all →InsufficientDeliveryPolicyException; a policy passes if anyAllowstatement's principal coversconfig.amazonaws.comor*and its action coverss3:PutObject(includings3:Put*,s3:*,*); the resource ARN is not matched, and a shape substrate's parser cannot decode passes. The two failure directions are not symmetric: always accepting hides a bucket-policy bug that is fatal at AWS, while demanding the documented policy verbatim refuses policies AWS accepts — and a wrong refusal breaks working code.Three seed families (
/v1/config/recorder-status,/v1/config/delivery-status,/v1/config/delivery-policy) cover what no API call can reach: substrate delivers nothing to S3, so no sequence of calls produces a failed delivery, and a consumer's delivery-failure branch exists precisely for one. Applied at read time, scoped by account and Region with*wildcards, and validated against the model's enum —NotApplicableis refused in favour of theNot_ApplicableAWS actually spells, and an error code on a non-Failurestatus is refused rather than half-applied.The routing alias is the hard prerequisite
Config's
X-Amz-Targetprefix isStarlingDoveService— an internal code name, asTrentServiceis KMS's — andstarlingdoveservicewas absent fromtargetServiceAliases, so it reduced to nothing and every SDK call fell through toservice not emulated: starlingdoveservice. Without the alias this plugin would be registered and unit-tested green while unreachable, exactly what #561, #610 and #636 were. A unit test asserts resolution by target prefix, host and SigV4 signing name.Two defects the live CLI caught, which unit tests did not
Both were fixed against the botocore model, not recall:
configStreamDeliveryInfoisConfigStreamDeliveryInfo, which carrieslastStatusChangeTimeand neither of the export shape'slastSuccessfulTime/lastAttemptTime. I had emitted three clones of one shape, putting members in the response an SDK decoding the stream shape cannot read. It also reportsNot_Applicablewhen no SNS topic is configured, per the shape's own note — reportingSuccesswould tell a consumer its alerting works when no topic exists.exclusionByResourceTypeslist of the four types. AWS returns no such list for anallSupportedgroup, and an exclusion list alongsideALL_SUPPORTED_RESOURCE_TYPESis the combinationInvalidRecordingGroupExceptionrefuses — substrate would have answered with a group it rejects on input. It is nowincludeGlobalResourceTypes: false, the bundle AWS uses.Verification
gofmt -l,go build ./...,go vet ./...,golangci-lint run ./...→ 0 issuesmake test(race) green; coverage 82.6%make docs-reference docs-reference-check docs-versions,npm --prefix docs run buildgreensubstrate server --address :4678withAWS_MAX_ATTEMPTS=1: reachability, the full bucket-policy progression,recording: false→true, regional isolation,InvalidRoleException, the reserved name prefix,InvalidRecordingGroupException, both status seeds, and the whole teardown ordering sequence. This tier is what catches an unroutable operation.Recording: trueon Put (8), theStartchannel guard dropped, the channel-delete guard dropped, the policy matcher forced permissive and forced strict, tags overwritten on a second Put, the Region dropped from a state key, the stream shape replaced with the export shape, andNot_Applicablecollapsed toSuccess.Not
Closes #580— that goes on PR 7, once the rules, packs, tagging, CFN stubs and e2e journey have landed.