discovery.scaleway
discovery.scaleway
discovers targets from Scaleway instances and baremetal services.
Usage
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:
Name | Type | Description | Default | Required |
---|---|---|---|---|
project_id | string | Scaleway project ID of targets. | yes | |
role | string | Role of targets to retrieve. | yes | |
api_url | string | Scaleway API URL. | "https://api.scaleway.com" | no |
zone | string | Availability zone of targets. | "fr-par-1" | no |
access_key | string | Access key for the Scaleway API. | yes | |
secret_key | secret | Secret key for the Scaleway API. | conditional | |
secret_key_file | string | Path to file containing secret key for the Scaleway API. | conditional | |
name_filter | string | Name filter to apply against the listing request. | no | |
tags_filter | list(string) | List of tags to search for. | no | |
refresh_interval | duration | Frequency to rediscover targets. | "60s" | no |
port | number | Default port on servers to associate with generated targets. | 80 | no |
proxy_url | string | HTTP proxy to send requests through. | no | |
no_proxy | string | Comma-separated list of IP addresses, CIDR notations, and domain names to exclude from proxying. | no | |
proxy_from_environment | bool | Use the proxy URL indicated by environment variables. | false | no |
proxy_connect_header | map(list(secret)) | Specifies headers to send to proxies during CONNECT requests. | no | |
follow_redirects | bool | Whether redirects returned by the server should be followed. | true | no |
enable_http2 | bool | Whether HTTP2 is supported for requests. | true | no |
The role
argument determines what type of Scaleway machines to discover.
It must be set to one of the following:
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
:
Hierarchy | Block | Description | Required |
---|---|---|---|
tls_config | tls_config | Configure 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
Name | Type | Description | Default | Required |
---|---|---|---|---|
ca_pem | string | CA PEM-encoded text to validate the server with. | no | |
ca_file | string | CA certificate to validate the server with. | no | |
cert_pem | string | Certificate PEM-encoded text for client authentication. | no | |
cert_file | string | Certificate file for client authentication. | no | |
insecure_skip_verify | bool | Disables validation of the server certificate. | no | |
key_file | string | Key file for client authentication. | no | |
key_pem | secret | Key PEM-encoded text for client authentication. | no | |
min_version | string | Minimum acceptable TLS version. | no | |
server_name | string | ServerName 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
andca_file
cert_pem
andcert_file
key_pem
andkey_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:
Name | Type | Description |
---|---|---|
targets | list(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
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 tobaremetal
to discover baremetal machines orinstance
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:
- Components that consume Targets
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.