Documentation
¶
Overview ¶
Command cfnattrgen generates services/cloudformation's Fn::GetAtt attribute table from the CloudFormation resource specification. Real CreateStack/UpdateStack rejects Fn::GetAtt on an attribute a resource type doesn't support ("Template error: resource <X> does not support attribute type <Y> in Fn::GetAtt"); this table is what lets validateIntrinsics tell an undocumented attribute from a merely-unmodelled one (gopherstack-p7pvq).
The table is emitted as JSON (services/cloudformation/cfn_attributes.json), not Go source: goconst counts string literals package-wide, and a generated .go file's literals still push hand-written files over the min-occurrences threshold even when the generated file itself is excluded from lint reporting (verified empirically -- see gopherstack-erj2j). A resource type is included only when the package declares a resTypeXxx constant for it (the provisioner's supported-types surface) and the spec documents a non-empty Attributes set for it; every documented attribute is emitted, since there's no literal-count reason left to drop any.
Usage:
go run ./cmd/cfnattrgen -spec <cfn-resource-spec.json> -src <dir> -out <out.json>
Or, to refresh the trimmed spec fixture used for -spec from a fresh download of the full CloudFormation resource specification:
go run ./cmd/cfnattrgen -spec <full-spec.json> -trimspec-out <fixture.json>