Clone the repository:
git clone https://github.com/cloudquery/cq-provider-aws
Build the provider:
make build
- Download CloudQuery latest version.
- Execute
make run
and note of theCQ_REATTACH_PROVIDERS
value. - Open another terminal and run
CQ_REATTACH_PROVIDERS=[VALUE_FROM_PREV] ./cloudquery fetch
Make sure the authentication variables are exported in the provider process and not in cloudquery process.
See docs for more details.
The provider has two types of tests:
- Unit Tests - run locally without any credentials and use mocking to return data from AWS APIs.
- Integration Tests - run against real AWS APIs and uses test environment defined with
terraform
underterraform/service_name/
Unit Tests don't require any credentials or internet access
make test-unit # This runs go test ./...
Unit tests include:
- Specific resources tests. You can find those next to each resource, in the
resources/services
folder. - DB migration tests. You can find the code for these tests here.
- Client tests. You can find those in the
client
folder.
These are documented in the Adding a new resource guide. See here for more information.
This repository provides a pre-commit hook to check your code before committing it. To use it:
- Install pre-commit (on Mac OS:
brew install pre-commit
) - Install golangci-lint (on Mac OS:
brew install golangci-lint
) - In the root of this repo, run:
make install-hooks
Now your code will be statically checked for errors prior to commit.