Skip to main content

Query Endpoints

An endpoint is the URL that serves as the entry point for your DW service unit. To programmatically connect to your DW service unit or its associated resources, you'll need an endpoint.

This guide describes how to use a Terraform script to query available endpoints.


Procedure

  1. Download the latest Terraform script.

    Following is a code snippet example from the module for creating DW service units. Configure the parameters according to your needs.

    terraform {
    required_providers {
    relyt = {
    source = "relytcloud/relyt"
    }
    }
    }
    provider "relyt" {
    role = "SYSTEMADMIN"
    }

    data "relyt_cloud_region_endpoints" "endpoint_list" {
    cloud = var.cloud
    region = var.region
    }

    Field description:

    FieldDescription
    sourceThe name of the Relyt plugin. It is fixed to relytcloud/relyt.
    roleThe system role of your Relyt cloud account. It is fixed to SYSTEMADMIN.

  2. Run the following command to initialize the Terraform working directory.

    terraform init

    The operation is successful when similar information appears as shown in the following picture.

  3. Run the following command to apply the module.

    terraform apply --target=module.relyt_cloud_region_endpoints
  4. When prompted, enter yes to confirm the operation.

  5. When Apply complete is displayed, run the following command.

    terraform show

    Information similar to the following will be displayed.

    In this example, only one endpoint is returned.

    Fields returned for each endpoint include:

    • cloud: the cloud provider of the region. It is fixed to aws.

    • host: the host name.

    • id: a reserved parameter. Ignore this field.

    • open: whether the endpoint is public. true indicates the endpoint is public. false indicates the endpoint is private and accessible only via private connections.

    • port: the port number.

    • protocol: the access protocol.

    • type: the type of the endpoint. It is fixed to openapi, indicating that the endpoint is accessible via Open API.

    • uri: the URI of the endpoint.