Skip to content
This repository was archived by the owner on Aug 16, 2022. It is now read-only.

Commit fe5a5ad

Browse files
authored
fix(docs): Update documentation about adding new resources (#1136)
* fix(docs): Update documentation about adding new resources * Update to recommend AWS_PROFILE over AWS_SECRET_ACCESS_KEY
1 parent 5ad50ed commit fe5a5ad

1 file changed

Lines changed: 17 additions & 8 deletions

File tree

docs/contributing/adding_a_new_resource.md

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,32 +59,41 @@ A few important things to note when adding functions that call the AWS API:
5959

6060
To prepare your environment for running integration tests:
6161
```bash
62+
# Start Postgres in a Docker container
6263
docker run -p 5432:5432 -e POSTGRES_PASSWORD=pass -d postgres:13.3
63-
# login with AWS. See all options at https://hub.cloudquery.io/providers/cloudquery/aws/latest
64-
gcloud auth application-default login
64+
65+
# Login with AWS. AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY can also be used here, if you wish.
66+
# See all options at https://hub.cloudquery.io/providers/cloudquery/aws/latest
67+
export AWS_PROFILE={Your AWS profile}
6568
```
6669

67-
To run integration test for specific table:
70+
To run an integration test for a specific table:
6871

6972
```bash
7073
go test -run="TestIntegration/ROOT_TABLE_NAME" -tags=integration ./...
7174
# For example
72-
go test -run="TestIntegration/azure_sql_managed_instances" -tags=integration ./...
75+
go test -run="TestIntegration/aws_lambda_functions" -tags=integration ./...
7376
```
7477

78+
> Note: You can override the Postgres database URL used for integration tests by specifying a DATABASE_URL environment variable, for example:
79+
>
80+
> ```
81+
> export DATABASE_URL="host=localhost user=postgres password=pass DB.name=postgres port=5432"
82+
> ```
83+
7584
To run all integration tests:
7685
7786
```bash
7887
go test -run=TestIntegration -tags=integration ./...
7988
```
8089
81-
>**Important** When adding a single resource, it's more common to only run the test for a specific table. You'll need to ensure your resource has the relevant Terraform service deployed
90+
>**Important** When adding a single resource, it's more common to only run the test for a specific table. You'll need to ensure your resource has the relevant Terraform service deployed.
8291
8392
#### Adding new Terraform Files Guidelines
8493

8594
Terraform files are organized under the [`terraform`](../../terraform/) folder, and each service has its own folder.
8695
Under each service folder, we organize files into 3 folders:
87-
- `local`: When testing locally run the terraform CLI from here
96+
- `local`: When testing locally run the Terraform CLI from here
8897
- `modules/tests`: Terraform resource and module definitions go here
8998
- `prod`: This folder is used for our CI testing. See relevant scripts [here](../../scripts/). **Not to be used locally**
9099

@@ -96,12 +105,12 @@ There are a few good rules of thumb to follow when creating new terraform resour
96105
* For every compute/db try to use the smallest size to keep the cost low
97106
* If autoscaling option is present, always turn it off
98107

99-
If you want to apply the terraform locally first before pushing it to CI and applying there use:
108+
If you want to apply the Terraform locally first before pushing it to CI and applying there, use:
100109

101110
```bash
102111
cd terraform/YOUR_SERVICE_NAME/local
103112
terraform init
104-
# Use AB as your initial so you can have multiple team members working on the same account without conflicting resources
113+
# Replace AB with your own initials so multiple team members can work on the same account without conflicting resources
105114
terraform apply -var="prefix=AB"
106115
go test -run="TestIntegration/ROOT_TABLE_NAME" -tags=integration ./...
107116
```

0 commit comments

Comments
 (0)