fix: strengthen types, simplify logic (#154) @goruha (#164)
what
- enable & use optional attributes where AWS API marks fields optional
- remove redundant lookups
- strengthen types for
log_configuration
,repository_credentials
,system_controls
,container_definition
- reorder object var attributes to match AWS docs
- simplify log configuration sanitization/munging
- simplify secret & environment var sorting
- expose unencoded container definition output directly without requiring pointless
jsonencode
/jsondecode
cycle
why
optional
obviateslookup(..., null)
calls for objectslookup(o, k)
without adefault
is deprecated in favor ofo[k]
or direct attr access (o.k
)log_configuration
,repository_credentials
, andsystem_controls
had needlessly opaqueany
types which hinder DX and make subtle bugs more likely (e.g. in the types oflog_configuration.options
values)- since all attributes of
container_definition
are now typed there's no reason not to type it as well - following the AWS documentation's field order makes types easier to verify for completeness & correctness
- typing
log_configuration
appropriately obviates explicittostring
&null
handling; resolves #151 - env/secret map sorting can be dramatically simplified since
for
-expressions iterate over maps & objects by key in lexicographic order jsonencode
-ing the final container definition only tojsondecode
forjson_map_object
is redundant
Refs
Sync github @max-lobur (#161)
Sync github from the template