A Destination is the system that your Pipelines load data into, such as Snowflake or Amazon Redshift. You create and manage a Destination with the hevo_destination resource. Each type of Destination is handled by a connector, such as snowflake or redshift, and each connector accepts a different set of configuration settings.
Prerequisites
-
An active Hevo account. You can start with a 14-day full-feature, free trial account.
-
You are assigned the required role for the actions that you want to perform.
-
You have generated your API credentials. Read Authentication for the steps to generate them.
-
The machine or CI/CD runner that runs Terraform uses Terraform version 1.5 or higher.
-
You have configured the Hevo provider. Read Configuring the Hevo Terraform Provider for the steps.
-
You have the connection details and credentials of your Destination, such as its host name and a user that Hevo can connect with.
Creating a Destination
To create a Destination, specify its name, its connector, and the configuration settings that the connector requires:
resource "hevo_destination" "redshift" {
name = "Redshift Warehouse"
connector_id = "redshift"
config = {
cluster_identifier = var.redshift_host
database_port = 5439
database_name = "analytics"
database_user = var.redshift_user
database_password = var.redshift_password
}
}The keys in config are the names of the connector's settings. To find them, read the connector with the hevo_connector_metadata data source. The documentation of each Destination explains how to obtain the value of each setting.
When you run the terraform plan command, the provider checks config against the connector's settings, and reports a missing required setting, a setting that the connector does not have, or a value of the wrong type.
When you run the terraform apply command, Hevo tests the connection to the Destination before it creates it. If the test fails, for example, because the user name or password is incorrect, Hevo does not create the Destination, and Terraform displays the reason.
The request to create a Destination can also fail because of a timeout, or a network or server error. Hevo can still create the Destination after the error, so the provider looks for a Destination with the same name. If it finds the Destination, Terraform manages it, and displays a warning with the ID of the Destination.
Providing Credentials
Hevo treats some settings of a connector, such as passwords and private keys, as credentials. You can set a credential when you create or change a Destination, but Hevo does not return its value. When you read the Destination, the credential appears as ********. The hevo_connector_metadata data source lists these settings in write_only_config_keys.
The provider keeps the value of each credential from your configuration, as Hevo does not return it. As a result, the provider does not detect a change made to a credential outside Terraform.
Provide each credential through a sensitive variable:
variable "redshift_password" {
type = string
sensitive = true
}Terraform then displays the value as (sensitive value) in the output of the terraform plan command. If you write a credential in config as a literal value instead, Terraform displays it in plain text when you run the terraform plan and terraform apply commands.
In both cases, Terraform stores the credential in plain text in the state file, the file in which Terraform records the resources that it manages. Protect the state file so that only authorized users can access it.
Changing a Destination
To change a Destination, edit its configuration and run the terraform apply command. The provider compares only the settings that you specify in config with the Destination in Hevo. Settings that you do not specify keep the values that Hevo assigned to them.
-
Name: Hevo changes the name without testing the connection.
-
Configuration settings: Hevo tests the connection with the new settings before it saves them. If the test fails, for example, because of an incorrect password, the
terraform applycommand fails with the reason, and the Destination keeps its previous settings. Your Pipelines continue to load data into it. -
Settings that cannot be changed: Some settings, such as
is_serverless, can be set only when the Destination is created. Theterraform plancommand shows a change to such a setting as an update, but theterraform applycommand fails with an error that names the setting.Remove the change from your configuration to clear the error. If you add such a setting to
configwith the value that the Destination already has, theterraform applycommand succeeds and the provider does not send the setting to Hevo. -
Connector: Changing
connector_idreplaces the Destination. Terraform deletes the Destination and creates a new Destination with the new connector. Theterraform plancommand marks the change as a replacement with# forces replacement. Specify the settings of the new connector inconfigalong with the change.Note:
-
If a Pipeline that Terraform does not manage loads data into the Destination, the deletion fails.
-
Changing the Destination of a Pipeline also replaces the Pipeline. As a result, Terraform also replaces the Pipelines that it manages and that load data into this Destination.
-
Deleting a Destination
To delete a Destination, remove it from your configuration and run the terraform apply command, or run the terraform destroy command.
If any Pipeline loads data into the Destination, including Pipelines that Terraform does not manage, Hevo does not delete the Destination. Terraform displays an error that lists the ID and name of each of these Pipelines.
Perform the following steps to delete the Destination along with the associated Pipelines:
-
Set
force_deletetotrueon the Destination:resource "hevo_destination" "redshift" { # ... force_delete = true } -
Run the
terraform applycommand. This saves the setting in the state file, without any change in Hevo. -
Delete the Destination with the
terraform destroycommand, or by removing it from your configuration and running theterraform applycommand.
Hevo deletes the Destination, the Pipelines that load data into it, and the Sources of those Pipelines. The tables in your Destination are not deleted. Drop them yourself if you no longer need the data.
With
force_deleteset totrue, Hevo also deletes Pipelines that Terraform does not manage. Before you delete the Destination, check the Pipelines that load data into it with the hevo_pipelines data source.
If Terraform manages both the Destination and its Pipelines, you do not need force_delete. Terraform deletes the Pipelines first, and then the Destination.
Arguments and Attributes
Arguments are the settings of the Destination that you specify in your configuration. Attributes are the values that Hevo assigns when it creates the Destination, such as its ID. You can refer to an attribute elsewhere in your configuration, for example, hevo_destination.redshift.id to set the Destination of a Pipeline.
Arguments
The following table lists the arguments of the hevo_destination resource:
| Argument | Description |
|---|---|
name (String, Required) | The name of the Destination. |
connector_id (String, Required) | The ID of the Destination connector. For example, redshift. Changing it replaces the Destination. |
config (Dynamic, Required) | The configuration settings of the Destination, named as the connector's settings. |
force_delete (Boolean, Optional) | If set to true, deleting the Destination also deletes the Pipelines that load data into it, including the Pipelines that Terraform does not manage, and their Sources. Default value: false. |
Attributes
The following table lists the attributes of the hevo_destination resource:
| Attribute | Description |
|---|---|
id (String) | The ID of the Destination. |
type (String) | The type of the Destination. For example, REDSHIFT. |
status (String) | The status of the Destination. For example, CREATED. |
created_at, updated_at (String) | The time when the Destination was created and last changed, in the Request for Comments (RFC) 3339 format. |
created_by, updated_by (String) | The user who created and last changed the Destination. |