This repo implements the Terraform provider for Sneller.
Run the following command to build the provider
$ go build -o terraform-provider-sneller$ go install github.com/goreleaser/goreleaser@latest$ make releaseYou will find the releases in the /dist directory. You will need to rename the provider binary to terraform-provider-sneller and move the binary into the appropriate subdirectory within the user plugins directory.
First, build and install the provider.
$ make installThen, navigate to the test directory.
$ cd testRun the following command to initialize the workspace and apply the sample configuration (make sure you set SNELLER_TOKEN).
$ export TF_VAR_SNELLER_TOKEN=<...>
$ terraform init && terraform applyThis will automatically:
- Create the IAM role that can be used by Sneller to access the S3 bucket.
- Create the Sneller source bucket (Sneller can only read).
- Create the Sneller cache bucket (Sneller can read/write).
- Assign the IAM role to the Sneller configuration for this region (default
us-east-1). - Setup the S3 event notification that signals Sneller when new data arrives in the source bucket.
- Create a table definition (db:
test-db, table:test-table). - Upload a test JSON file.
When you need to debug a resource/data-source, then debugging the integration tests is typically the most straightforward option. Testing the provider requires some environment variables:
TF_ACCshould be set to1to enable running the acceptance tests.SNELLER_TOKENshould be set to the bearer token of your tenant.TENANT_ACCOUNT_IDis optional and should be set to the AWS account identifier. If it's not set, then it defaults to the AWS account identifier of the AWS variables in the environment.SNELLER_API_ENDPOINTis optional and defaults to the default API endpoint of the production environment. This can be changed when testing against another end-point.
The testing process is quite slow, due to the amount of API calls. Therefore, it's recommended to
set the time-out to 10m.
You can use the following .vscode/settings.json file in the root of the repository to enable the
settings for running unit tests from within Visual Studio Code:
{
"go.testEnvVars": {
"TF_ACC": "1",
"SNELLER_TOKEN": "SA0xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
//"TENANT_ACCOUNT_ID": "093008718846",
//"SNELLER_API_ENDPOINT": "http://localhost:8080",
},
"go.testTimeout": "10m",
}The examples folder contain the Terraform samples for the documentation, but can also run
independent. Make sure to set the TF_VAR_sneller_token