How to get a list of all Cloudformation types in Javascript

The AWS CDK has a JSON file that describes available AWS types. You can install it like so:

npm install --save @aws-cdk/cfnspec

Retrieve the types:

const cdk = require('@aws-cdk/cfnspec');

console.log(_.keys(cdk.specification().ResourceTypes));

Example output:

[
  'AWS::AmazonMQ::Broker',
  'AWS::AmazonMQ::Configuration',
  'AWS::AmazonMQ::ConfigurationAssociation',
  'AWS::Amplify::App',
  'AWS::Amplify::Branch',
  'AWS::Amplify::Domain',
  'AWS::ApiGateway::Account',
  'AWS::ApiGateway::ApiKey',
  'AWS::ApiGateway::Authorizer',
  'AWS::ApiGateway::BasePathMapping',
  'AWS::ApiGateway::ClientCertificate',
  'AWS::ApiGateway::Deployment',
  'AWS::ApiGateway::DocumentationPart',
  'AWS::ApiGateway::DocumentationVersion',
  'AWS::ApiGateway::DomainName',
  'AWS::ApiGateway::GatewayResponse',
  'AWS::ApiGateway::Method',
  'AWS::ApiGateway::Model',
  'AWS::ApiGateway::RequestValidator',
  'AWS::ApiGateway::Resource',
  'AWS::ApiGateway::RestApi',
  'AWS::ApiGateway::Stage',
  'AWS::ApiGateway::UsagePlan',
  'AWS::ApiGateway::UsagePlanKey',
  'AWS::ApiGateway::VpcLink',
  'AWS::ApiGatewayV2::Api',
  'AWS::ApiGatewayV2::ApiMapping',
  'AWS::ApiGatewayV2::Authorizer',
  'AWS::ApiGatewayV2::Deployment',
  'AWS::ApiGatewayV2::DomainName',
  'AWS::ApiGatewayV2::Integration',
  'AWS::ApiGatewayV2::IntegrationResponse',
  'AWS::ApiGatewayV2::Model',
  'AWS::ApiGatewayV2::Route',
  'AWS::ApiGatewayV2::RouteResponse',
  'AWS::ApiGatewayV2::Stage',
  'AWS::AppMesh::Mesh',
  'AWS::AppMesh::Route',
  'AWS::AppMesh::VirtualNode',
  'AWS::AppMesh::VirtualRouter',
  'AWS::AppMesh::VirtualService',
  'AWS::AppStream::DirectoryConfig',
  'AWS::AppStream::Fleet',
  'AWS::AppStream::ImageBuilder',
  'AWS::AppStream::Stack',
  'AWS::AppStream::StackFleetAssociation',
  'AWS::AppStream::StackUserAssociation',
  'AWS::AppStream::User',
  'AWS::AppSync::ApiKey',
  'AWS::AppSync::DataSource',
  'AWS::AppSync::FunctionConfiguration',
  'AWS::AppSync::GraphQLApi',
  'AWS::AppSync::GraphQLSchema',
  'AWS::AppSync::Resolver',
  'AWS::ApplicationAutoScaling::ScalableTarget',
  'AWS::ApplicationAutoScaling::ScalingPolicy',
  'AWS::Athena::NamedQuery',
  'AWS::AutoScaling::AutoScalingGroup',
  'AWS::AutoScaling::LaunchConfiguration',
  'AWS::AutoScaling::LifecycleHook',
  'AWS::AutoScaling::ScalingPolicy',
  'AWS::AutoScaling::ScheduledAction',
  'AWS::AutoScalingPlans::ScalingPlan',
  'AWS::Backup::BackupPlan',
  'AWS::Backup::BackupSelection',
  'AWS::Backup::BackupVault',
  'AWS::Batch::ComputeEnvironment',
  'AWS::Batch::JobDefinition',
  'AWS::Batch::JobQueue',
  'AWS::Budgets::Budget',
  'AWS::CertificateManager::Certificate',
  'AWS::Cloud9::EnvironmentEC2',
  'AWS::CloudFormation::CustomResource',
  'AWS::CloudFormation::Macro',
  'AWS::CloudFormation::Stack',
  'AWS::CloudFormation::WaitCondition',
  'AWS::CloudFormation::WaitConditionHandle',
  'AWS::CloudFront::CloudFrontOriginAccessIdentity',
  'AWS::CloudFront::Distribution',
  'AWS::CloudFront::StreamingDistribution',
  'AWS::CloudTrail::Trail',
  'AWS::CloudWatch::Alarm',
  'AWS::CloudWatch::AnomalyDetector',
  'AWS::CloudWatch::Dashboard',
  'AWS::CodeBuild::Project',
  'AWS::CodeBuild::SourceCredential',
  'AWS::CodeCommit::Repository',
  'AWS::CodeDeploy::Application',
  'AWS::CodeDeploy::DeploymentConfig',
  'AWS::CodeDeploy::DeploymentGroup',
  'AWS::CodePipeline::CustomActionType',
  'AWS::CodePipeline::Pipeline',
  'AWS::CodePipeline::Webhook',
  'AWS::CodeStar::GitHubRepository',
  'AWS::Cognito::IdentityPool',
  'AWS::Cognito::IdentityPoolRoleAttachment',
  'AWS::Cognito::UserPool',
  'AWS::Cognito::UserPoolClient',
  'AWS::Cognito::UserPoolGroup',
  'AWS::Cognito::UserPoolUser',
  ... 351 more items