Menu

This is documentation for the next version of Alloy. For the latest stable release, go to the latest version.

Open source

discovery.scaleway

discovery.scaleway discovers targets from Scaleway instances and baremetal services.

Usage

alloy
discovery.scaleway "LABEL" {
    project_id = "SCALEWAY_PROJECT_ID"
    role       = "SCALEWAY_PROJECT_ROLE"
    access_key = "SCALEWAY_ACCESS_KEY"
    secret_key = "SCALEWAY_SECRET_KEY"
}

Arguments

The following arguments are supported:

NameTypeDescriptionDefaultRequired
project_idstringScaleway project ID of targets.yes
rolestringRole of targets to retrieve.yes
api_urlstringScaleway API URL."https://api.scaleway.com"no
zonestringAvailability zone of targets."fr-par-1"no
access_keystringAccess key for the Scaleway API.yes
secret_keysecretSecret key for the Scaleway API.conditional
secret_key_filestringPath to file containing secret key for the Scaleway API.conditional
name_filterstringName filter to apply against the listing request.no
tags_filterlist(string)List of tags to search for.no
refresh_intervaldurationFrequency to rediscover targets."60s"no
portnumberDefault port on servers to associate with generated targets.80no
proxy_urlstringHTTP proxy to send requests through.no
no_proxystringComma-separated list of IP addresses, CIDR notations, and domain names to exclude from proxying.no
proxy_from_environmentboolUse the proxy URL indicated by environment variables.falseno
proxy_connect_headermap(list(secret))Specifies headers to send to proxies during CONNECT requests.no
follow_redirectsboolWhether redirects returned by the server should be followed.trueno
enable_http2boolWhether HTTP2 is supported for requests.trueno

The role argument determines what type of Scaleway machines to discover. It must be set to one of the following:

  • "baremetal": Discover baremetal Scaleway machines.
  • "instance": Discover virtual Scaleway instances.

The name_filter and tags_filter arguments can be used to filter the set of discovered servers. name_filter returns machines matching a specific name, while tags_filter returns machines who contain all the tags listed in the tags_filter argument.

no_proxy can contain IPs, CIDR notations, and domain names. IP and domain names can contain port numbers. proxy_url must be configured if no_proxy is configured.

proxy_from_environment uses the environment variables HTTP_PROXY, HTTPS_PROXY and NO_PROXY (or the lowercase versions thereof). Requests use the proxy from the environment variable matching their scheme, unless excluded by NO_PROXY. proxy_url and no_proxy must not be configured if proxy_from_environment is configured.

proxy_connect_header should only be configured if proxy_url or proxy_from_environment are configured.

Blocks

The following blocks are supported inside the definition of discovery.scaleway:

HierarchyBlockDescriptionRequired
tls_configtls_configConfigure TLS settings for connecting to the endpoint.no

The > symbol indicates deeper levels of nesting. For example, oauth2 > tls_config refers to a tls_config block defined inside an oauth2 block.

tls_config block

NameTypeDescriptionDefaultRequired
ca_pemstringCA PEM-encoded text to validate the server with.no
ca_filestringCA certificate to validate the server with.no
cert_pemstringCertificate PEM-encoded text for client authentication.no
cert_filestringCertificate file for client authentication.no
insecure_skip_verifyboolDisables validation of the server certificate.no
key_filestringKey file for client authentication.no
key_pemsecretKey PEM-encoded text for client authentication.no
min_versionstringMinimum acceptable TLS version.no
server_namestringServerName extension to indicate the name of the server.no

The following pairs of arguments are mutually exclusive and can’t both be set simultaneously:

  • ca_pem and ca_file
  • cert_pem and cert_file
  • key_pem and key_file

When configuring client authentication, both the client certificate (using cert_pem or cert_file) and the client key (using key_pem or key_file) must be provided.

When min_version is not provided, the minimum acceptable TLS version is inherited from Go’s default minimum version, TLS 1.2. If min_version is provided, it must be set to one of the following strings:

  • "TLS10" (TLS 1.0)
  • "TLS11" (TLS 1.1)
  • "TLS12" (TLS 1.2)
  • "TLS13" (TLS 1.3)

Exported fields

The following fields are exported and can be referenced by other components:

NameTypeDescription
targetslist(map(string))The set of targets discovered from the Consul catalog API.

When role is baremetal, discovered targets include the following labels:

  • __meta_scaleway_baremetal_id: ID of the server.
  • __meta_scaleway_baremetal_public_ipv4: Public IPv4 address of the server.
  • __meta_scaleway_baremetal_public_ipv6: Public IPv6 address of the server.
  • __meta_scaleway_baremetal_name: Name of the server.
  • __meta_scaleway_baremetal_os_name: Operating system name of the server.
  • __meta_scaleway_baremetal_os_version: Operation system version of the server.
  • __meta_scaleway_baremetal_project_id: Project ID the server belongs to.
  • __meta_scaleway_baremetal_status: Current status of the server.
  • __meta_scaleway_baremetal_tags: The list of tags associated with the server concatenated with a ,.
  • __meta_scaleway_baremetal_type: Commercial type of the server.
  • __meta_scaleway_baremetal_zone: Availability zone of the server.

When role is instance, discovered targets include the following labels:

  • __meta_scaleway_instance_boot_type: Boot type of the server.
  • __meta_scaleway_instance_hostname: Hostname of the server.
  • __meta_scaleway_instance_id: ID of the server.
  • __meta_scaleway_instance_image_arch: Architecture of the image the server is running.
  • __meta_scaleway_instance_image_id: ID of the image the server is running.
  • __meta_scaleway_instance_image_name: Name of the image the server is running.
  • __meta_scaleway_instance_location_cluster_id: ID of the cluster for the server’s location.
  • __meta_scaleway_instance_location_hypervisor_id: Hypervisor ID for the server’s location.
  • __meta_scaleway_instance_location_node_id: Node ID for the server’s location.
  • __meta_scaleway_instance_name: Name of the server.
  • __meta_scaleway_instance_organization_id: Organization ID that the server belongs to.
  • __meta_scaleway_instance_private_ipv4: Private IPv4 address of the server.
  • __meta_scaleway_instance_project_id: Project ID the server belongs to.
  • __meta_scaleway_instance_public_ipv4: Public IPv4 address of the server.
  • __meta_scaleway_instance_public_ipv6: Public IPv6 address of the server.
  • __meta_scaleway_instance_region: Region of the server.
  • __meta_scaleway_instance_security_group_id: ID of the security group the server is assigned to.
  • __meta_scaleway_instance_security_group_name: Name of the security group the server is assigned to.
  • __meta_scaleway_instance_status: Current status of the server.
  • __meta_scaleway_instance_tags: The list of tags associated with the server concatenated with a ,.
  • __meta_scaleway_instance_type: Commercial type of the server.
  • __meta_scaleway_instance_zone: Availability zone of the server.

Component health

discovery.scaleway is only reported as unhealthy when given an invalid configuration. In those cases, exported fields retain their last healthy values.

Debug information

discovery.scaleway does not expose any component-specific debug information.

Debug metrics

discovery.scaleway does not expose any component-specific debug metrics.

Example

alloy
discovery.scaleway "example" {
    project_id = "SCALEWAY_PROJECT_ID"
    role       = "SCALEWAY_PROJECT_ROLE"
    access_key = "SCALEWAY_ACCESS_KEY"
    secret_key = "SCALEWAY_SECRET_KEY"
}

prometheus.scrape "demo" {
    targets    = discovery.scaleway.example.targets
    forward_to = [prometheus.remote_write.demo.receiver]
}

prometheus.remote_write "demo" {
    endpoint {
        url = PROMETHEUS_REMOTE_WRITE_URL

        basic_auth {
            username = USERNAME
            password = PASSWORD
        }
    }
}

Replace the following:

  • SCALEWAY_PROJECT_ID: The project ID of your Scaleway machines.
  • SCALEWAY_PROJECT_ROLE: Set to baremetal to discover baremetal machines or instance to discover virtual instances.
  • SCALEWAY_ACCESS_KEY: Your Scaleway API access key.
  • SCALEWAY_SECRET_KEY: Your Scaleway API secret key.
  • PROMETHEUS_REMOTE_WRITE_URL: The URL of the Prometheus remote_write-compatible server to send metrics to.
  • USERNAME: The username to use for authentication to the remote_write API.
  • PASSWORD: The password to use for authentication to the remote_write API.

Compatible components

discovery.scaleway has exports that can be consumed by the following components:

Note

Connecting some components may not be sensible or components may require further configuration to make the connection work correctly. Refer to the linked documentation for more details.