Skip to content

stackql/aws-cfn-schema-to-openapi

Repository files navigation

aws-cfn-schema-to-openapi

Convert AWS CloudFormation Resource Specification to OpenAPI 3.0.0

Generating OpenAPI3 Specs

  1. run sh download-and-preprocess-defs.sh
  2. run python3 get_cc_supported_resources.py > cc_supported_resources.js (requires AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY env vars to be set)
  3. run npm install
  4. run node index.js

output openapi3 specs (components/schemas) are written to src/aws/v00.00.00000/services

Testing locally with stackql

  1. ensure the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables are set
  2. download the latest stackql binary, for example curl -L https://bit.ly/stackql-zip -O && unzip stackql-zip for Linux systems
  3. run the following:
PROVIDER_REGISTRY_ROOT_DIR="$(pwd)"
REG_STR='{"url": "file://'${PROVIDER_REGISTRY_ROOT_DIR}'", "localDocRoot": "'${PROVIDER_REGISTRY_ROOT_DIR}'", "verifyConfig": {"nopVerify": true}}'
./stackql shell --registry="${REG_STR}"
  1. run stackql commands, for example
select * from aws.s3.buckets WHERE region = 'us-east-1';
select bucket_name, region, bucket_encryption_server_side_encryption_configuration from aws.s3.bucket WHERE region = 'us-east-1' and data__Identifier = 'stackql-trial-bucket-01';

Run Test Suite

from the stackql-provider-tests directory:

cd /mnt/c/LocalGitRepos/stackql/core/stackql-provider-tests

# aws
sh test-provider.sh \
aws \
false \
/mnt/c/LocalGitRepos/stackql/openapi-conversion/aws-cfn-schema-to-openapi \
true

cd /mnt/c/LocalGitRepos/stackql/openapi-conversion/aws-cfn-schema-to-openapi

Generate User Markdown Docs

Use the following script to generate user docs with Docusaurus front matter for AWS view resources:

node lib/utils/generate-docs.js

output markdown docs are written to aws-docs

Troubleshooting AWS Cloud Control

To troubleshoot AWS Cloud Control API requests (mutation requests), use the following queries:

select * from aws.cloud_control.resource_requests
where data__ResourceRequestStatusFilter = '{"OperationStatuses": ["FAILED"], "Operations": ["CREATE"]}'
and region = 'ap-southeast-2';
--or
select * from aws.cloud_control.resource_requests
where data__ResourceRequestStatusFilter = '{"OperationStatuses": ["FAILED"], "Operations": ["DELETE"]}'
and region = 'us-east-1';
--or
select * from aws.cloud_control.resource_requests
where data__ResourceRequestStatusFilter = '{"OperationStatuses": ["SUCCESS"], "Operations": ["UPDATE"]}'
and region = 'ap-southeast-2';

(replace region accordingly)

select * from aws.cloud_control.resource_request
where data__RequestToken = '54061545-e0a0-4ef0-b213-41fda81d8c24'
and region = 'ap-southeast-2';

(replace region and data__RequestToken accordingly)

check for AWS CC updates

See here for newly added or updated Cloud Control resources.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published