Model sync (Reverse ETL) from BigQuery to Salesforce
Model sync (Reverse ETL) from BigQuery to Salesforce
This example creates a Model Sync from BigQuery to Salesforce using the Polytomic Terraform provider.
Prerequisites:
- Install the Polytomic Terraform provider.
- Set your Polytomic API key as an environment variable.
1. Configure the Polytomic provider
Configure the Polytomic provider in your Terraform script:
Define var.polytomic_api_key in your variables file or pass it at apply time.
🤝 Partner keys
If you are using a Partner Key, specify the key along with an organization user email. A user with that email will be used when operating on an organization. The user will be created if it does not exist.
2. Create a BigQuery connection
Define a resource for the BigQuery connection:
This example loads the service account key with the file function.
Any string value or variable works as well.
3. Create a Salesforce connection
Polytomic supports several authorization modes for Salesforce. To manage a Salesforce Connection from Terraform, you must supply the client ID and secret.
If you want to use Polytomic’s OAuth flow instead, create the Connection through the admin console or the authentication API, then reference it from Terraform with the Salesforce datasource.
Define the Salesforce Connection:
🤝 Partner keys
When using a partner key, you must also set the Organization ID on every resource.
4. Create a model over the user data
Define a model that queries BigQuery:
5. Create the Model Sync
Define a Model Sync to Salesforce. This example creates an update-only sync to Salesforce Contacts, matched on email address:
6. Apply the configuration
Initialize Terraform and apply:
Review the planned changes and confirm to proceed.
For more details, see the Polytomic Terraform provider documentation.
