Clover generates multi-cloud provider coverage for all resource types. The current supported providers are AWS, Azure, Hetzner and DigitalOcean.
This guide is for using generated Clover schemas for a local dev SI instance.
- Run an instance of SI locally. See the README for more details.
- In your local workspace, find the bearer token. You can find it in the headers of any request made to the SI backend and it starts with "Bearer". Or you can make and use a Workspace token following this guide.
- Copy the token to a safe location and remove the leading "Bearer" portion.
- Open your terminal for the next steps.
- Make your bearer token available for clover:
export SI_BEARER_TOKEN=<your-token>. - Change to the clover directory:
cd bin/clover. - Initialize the git submodule:
git submodule init src/provider-schemas/azure-rest-api-specs. - Change to the si-specs directory:
cd si-specs. - Generate clover schemas using
deno. For this guide, we'll use Azure:deno task run generate-specs --provider=azure. The directory will contain all generated Azure schemas. - In your local workspace in your browser, navigate to the customization screen.
- On the upper left, switch to the "MODULES (INTERNAL)" tab and click the
upload to cloud button. You'll be prompted to choose which files to upload.
The file names correspond with the modules that will be uploaded. You can
find the generated JSON files in
bin/clover/si-specs - In either a newly created change set or your non-HEAD change set, you will now be able to create components with your Azure module(s)!
Tip
If you have issues generating schemas, you may need to ensure you are using your local module index or that your submodule need to be re-configured.
For the former, run the following command: unset SI_MODULE_INDEX_URL. This
ensures that clover will use default settings for generation.
For the latter, you may need to update the submodule with
git submodule update or to de-initialize the submodule and start over via
git submodule deinit -f src/provider-schemas/azure-rest-api-specs (assuming
you are using Azure).
Before you can run the schema generator, you must download the latest Cloudformation resource type schema to cloudformation-schema/*.json:
deno task run fetch-schemaThis will fetch the current ID for each schema, and then regenerate all schemas into the si-specs directory.
deno task run generate-specs [...SCHEMA]generate-specswith no arguments to regenerate all specsgenerate-specs EC2 S3 SecurityGroupto regenerate all EC2 and S3 schemas, plus the SecurityGroup schemaSI_MODULE_INDEX_URL=https://module-index.systeminit.comto point at productionSI_MODULE_INDEX_URL=http://127.0.0.1:5157to point at your local module index. (If you do this, do NOT upload the resulting specs to production--they will have the wrong module IDs.)LOG_LEVEL=debug(or info, warning, error) for log output
When you have changed heuristics, you will want to look at the differences--but
the specs contain ULIDs, which change each time. You can run
anonymize-specs.sh runs jq to remove these (which will not change the specs,
but create an anonymized copy in si-specs/anonymized). After that, you can diff
the anonymized specs to see what your heuristic affected.
-
Baseline: Before you run your new changes, generated an anonymized baseline in
si-specs-old/anonymized:$ deno task run generate-specs && ./anonymize-specs.sh $ cp -R si-specs si-specs-old -
Regenerate: Regenerate and anonymize the specs to
si-specs/anonymized:$ deno task run generate-specs && ./anonymize-specs.sh -
Diff: Diff the results:
diff -u si-specs-old/anonymized si-specs/anonymized
-
Repeat steps 2-3 until satisfied.
If you are changing a lot of schema functions themselves, every package will
show codeBase64 changed, which is a giant blob and can get overwhelming.
To exclude codeBase64, add this to anonymize-specs.sh:
./anonymize-specs.sh --remove-props ".funcs[].data.codeBase64"Just note that if you do this, you won't know which modules had their schema code changed! Don't run it all the time.
buck2 run //bin/clover:test-unitenv LOG_LEVEL=verbose deno test --unstable-sloppy-imports -A