VS Code extension for automatically generating fully-expanded AWS CloudFormation resource templates.
Displays a prompt where an AWS resource type can be selected, and then inserts the fully-expanded template into the current text editor.
Command Palette > CFN Auto-template: Insert resource
Displays a prompt where a preferred AWS profile can be selected. The list of profiles are determined by the provided configuration file path. The AWS region will be automatically set if the selected profile definition includes a region
value.
Command Palette > CFN Auto-template: Set profile
Displays a prompt where a preferred template format can be selected. The only options supported are JSON
and YAML
. Note that this setting will be ignored if the format of the currently active text editor is set to JSON or YAML, in which case the produced template will be automatically detected.
Command Palette > CFN Auto-template: Set template format
Displays a prompt where an absolute path to an AWS configuration file can be provided. This will check that the file exists, parse the file contents, and validate that the file has at least one profile. If all checks pass, it will display a prompt where a preferred AWS profile can be selected.
Command Palette > CFN Auto-template: Set config file path
Displays a prompt where a preferred resource visibility can be selected. The only options supported by AWS are PUBLIC
(AWS-provided resources) and PRIVATE
(user-provided custom resources).
Command Palette > CFN Auto-template: Set resource visibility
Displays a prompt where a preferred AWS region can be selected, influencing which endpoint API calls are made against. Note that this will override the region
value found in the configuration file.
Command Palette > CFN Auto-template: Set region
By default, fetching a list of resources (public and private) and individual resources (public and private) are cached, per workspace, for 1 day. This convenience method will clear that cache. This can be especially useful for private CloudFormation types that are being registered and deregistered at-will.
Command Palette > CFN Auto-template: Bust cache
All settings can be modified by going to Preferences > Settings > Extensions > AWS CloudFormation Auto-template Generator
When working with AWS CloudFormation templates, I often find myself referencing the official documentation for a particular resource, which references a nested type, which references a nested type, which references...so on and so forth until reaching the string or boolean value that I'm looking for. This extension helps reduce that friction by automatically expanding the full template for any AWS resource, supporting both JSON and YAML templates.
For example, the commonplace AWS::S3::Bucket
resource has a property that's nested 5 levels deep until a final string value is reached, with each attribute along the way having it's own structure and sub-attributes:
ReplicationConfiguration
Rules # This happens to be an array...
SourceSelectionCriteria
SseKmsEncryptedObjects
Status # Finally reached the string value!
I've personally found the approach of working with a fully expanded template beneficial for learning CloudFormation, because it helps present a complete picture of the resource. Often times I know I need an S3 bucket, but it's unclear what options are available or how other resources might reference each other.
- Clone this repo (
git clone https://github.com/john-goldsmith/vscode-aws-cloudformation-auto-template-generator.git
) - Ensure that Node and NPM are installed
- Run
npm install
to install dependencies - In the "Run" panel of VS Code (View > Run), choose the "Run Extension" configuration, and click "Start Debugging" (shortcut: F5)
- In VS Code, set breakpoints as desired.
See vsc-extension-quickstart.md for additional details.
See test/unit for test suite, and Travis CI and Code Climate for coverage. After running tests, an Istanbul coverage report is generated in ./coverage/lcov-report/index.html
.
- Run
npm run test:unit
Current coverage:
Test Suites: 32 passed, 32 total
Tests: 133 passed, 133 total
See .eslintrc.json for configuration options.
- Run
npm run lint