### Complete Example with Cockpit Setup Source: https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/data-sources/cockpit_grafana This example demonstrates setting up a Scaleway project and Cockpit instance, then retrieving Grafana connection information. ```terraform resource "scaleway_account_project" "project" { name = "my-observability-project" } resource "scaleway_cockpit" "main" { project_id = scaleway_account_project.project.id } data "scaleway_cockpit_grafana" "main" { project_id = scaleway_cockpit.main.project_id } output "grafana_connection_info" { value = { url = data.scaleway_cockpit_grafana.main.grafana_url project_id = data.scaleway_cockpit_grafana.main.project_id } description = "Use your Scaleway IAM credentials to authenticate" } ``` -------------------------------- ### Node Agent Log Output Example Source: https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/guides/multicloud_cluster_with_baremetal_servers Example log output from the node agent, indicating successful startup of Kubelet and other services. Useful for verifying installation and troubleshooting. ```json {"time":"2023-05-24T16:47:38.750041045Z","level":"DEBUG","msg":"writing kubelet config and CA"} {"time":"2023-05-24T16:47:38.750272845Z","level":"DEBUG","msg":"writing kubelet env file and systemd service"} {"time":"2023-05-24T16:47:38.750410725Z","level":"DEBUG","msg":"writing kubeconfig files"} {"time":"2023-05-24T16:47:38.751171166Z","level":"DEBUG","msg":"starting containerd systemd service"} {"time":"2023-05-24T16:47:39.042781246Z","level":"DEBUG","msg":"starting kubelet systemd service"} {"time":"2023-05-24T16:47:39.056392423Z","level":"INFO","msg":"successfully started kubelet"} ``` -------------------------------- ### Scaleway Provider Example Configuration Source: https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/index This example demonstrates setting up a web server with a public IP, a security group, and an additional data volume using the Scaleway provider. Ensure your project ID is provided. ```terraform variable "project_id" { type = string description = "Your project ID." } terraform { required_providers { scaleway = { source = "scaleway/scaleway" } } required_version = ">= 0.13" } provider "scaleway" { zone = "fr-par-1" region = "fr-par" } resource "scaleway_instance_ip" "public_ip" { project_id = var.project_id } resource "scaleway_instance_ip" "public_ip_backup" { project_id = var.project_id } resource "scaleway_block_volume" "data" { project_id = var.project_id size_in_gb = 30 iops = 5000 } resource "scaleway_block_volume" "data_backup" { project_id = var.project_id size_in_gb = 10 iops = 5000 } resource "scaleway_instance_security_group" "www" { project_id = var.project_id inbound_default_policy = "drop" outbound_default_policy = "accept" inbound_rule { action = "accept" port = "22" ip_range = "0.0.0.0/0" } inbound_rule { action = "accept" port = "80" } inbound_rule { action = "accept" port = "443" } } resource "scaleway_instance_server" "web" { project_id = var.project_id type = "DEV1-L" image = "ubuntu_jammy" tags = ["front", "web"] ip_id = scaleway_instance_ip.public_ip.id additional_volume_ids = [scaleway_block_volume.data.id] root_volume { size_in_gb = 50 } security_group_id = scaleway_instance_security_group.www.id } ``` -------------------------------- ### Example Usage of scaleway_mongodb_databases Source: https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/data-sources/mongodb_databases This example demonstrates how to create a MongoDB instance and then use the scaleway_mongodb_databases data source to retrieve information about its databases. The output displays the names of all databases on the instance. ```hcl resource "scaleway_mongodb_instance" "main" { name = "foobar" version = "7.0" node_type = "MGDB-PLAY2-NANO" node_number = 1 user_name = "my_initial_user" password = "thiZ_is_v&ry_s3cret" } data "scaleway_mongodb_databases" "db" { instance_id = scaleway_mongodb_instance.main.id region = "fr-par" } output "database_names" { value = [for database in data.scaleway_mongodb_databases.db.databases : database.name] } ``` -------------------------------- ### Example Usage of scaleway_instance_ip_reverse_dns Source: https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/instance_ip_reverse_dns This example demonstrates how to create an instance IP and then configure its reverse DNS record. Ensure you have a Scaleway provider configured. ```terraform resource "scaleway_instance_ip" "server_ip" {} resource "scaleway_domain_record" "tf_A" { dns_zone = "scaleway.com" name = "www" type = "A" data = "${scaleway_instance_ip.server_ip.address}" ttl = 3600 priority = 1 } resource "scaleway_instance_ip_reverse_dns" "reverse" { ip_id = scaleway_instance_ip.server_ip.id reverse = "www.scaleway.com" } ``` -------------------------------- ### Basic Snapshot Creation Source: https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/instance_snapshot This example demonstrates how to create a basic instance snapshot from an existing volume. ```APIDOC ## scaleway_instance_snapshot main ### Description Creates a basic instance snapshot from an existing volume. ### Method resource "scaleway_instance_snapshot" "main" ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **name** (String) - Optional - The name of the snapshot. If not provided it will be randomly generated. - **volume_id** (String) - Required - The ID of the volume to take a snapshot from. - **type** (String) - Optional - The snapshot's volume type. Defaults to `l_ssd`. Updates to this field will recreate a new resource. - **zone** (String) - Optional - The zone in which the snapshot should be created. Defaults to provider `zone`. - **project_id** (String) - Optional - The ID of the project the snapshot is associated with. Defaults to provider `project_id`. - **tags** (List of String) - Optional - A list of tags to apply to the snapshot. - **import** (Object) - Optional - Import a snapshot from a qcow2 file located in a bucket - **bucket** (String) - Bucket name containing qcow2 to import - **key** (String) - Key of the object to import ### Request Example ```terraform resource "scaleway_instance_snapshot" "main" { name = "some-snapshot-name" volume_id = "11111111-1111-1111-1111-111111111111" } ``` ### Response #### Success Response (200) - **id** (String) - The ID of the snapshot. - **size_in_gb** (Number) - The size of the snapshot. - **organization_id** (String) - The organization ID the snapshot is associated with. - **project_id** (String) - The project ID the snapshot is associated with. - **created_at** (String) - The snapshot creation time. #### Response Example ```json { "id": "fr-par-1/11111111-1111-1111-1111-111111111111", "size_in_gb": 10, "organization_id": "some-org-id", "project_id": "some-project-id", "created_at": "2023-10-27T10:00:00Z" } ``` ``` -------------------------------- ### scaleway_vpc_ingress_rule Example with Tags Source: https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/vpc_ingress_rule This example demonstrates creating a VPC ingress rule with associated tags for organization and management. ```terraform resource "scaleway_vpc" "vpc01" { name = "my-vpc" } resource "scaleway_vpc_private_network" "pn01" { name = "my-private-network" vpc_id = scaleway_vpc.vpc01.id } resource "scaleway_vpc_ingress_rule" "main" { vpc_id = scaleway_vpc.vpc01.id source = "10.0.0.0/24" nexthop_private_network_id = scaleway_vpc_private_network.pn01.id nexthop_resource_ip = "10.0.0.10" description = "Allow ingress traffic from 10.0.0.0/24" tags = ["production", "ingress"] } ``` -------------------------------- ### Basic user creation Source: https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/rdb_user This example demonstrates how to create a basic database user with admin privileges. ```APIDOC ## scaleway_rdb_user.db_admin ### Description Creates a database user with admin privileges for an RDB instance. ### Method Resource ### Endpoint N/A (Terraform Resource) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body - **instance_id** (string) - Required - UUID of the Database Instance. - **name** (string) - Required - Database user name. - **password** (string) - Optional - Database user password. Must meet specific length and character type requirements. - **password_wo** (string) - Optional - Database user password in write-only mode. Use instead of `password` for enhanced security. Only one of `password` or `password_wo` should be specified. - **password_wo_version** (number) - Optional - The version of the write-only password. Must be updated if `password_wo` is updated. - **is_admin** (boolean) - Optional - Grant admin permissions to the database user. - **region** (string) - Optional - The Scaleway region this resource resides in. ### Request Example ```terraform resource "scaleway_rdb_instance" "main" { name = "test-rdb" node_type = "DB-DEV-S" engine = "PostgreSQL-15" is_ha_cluster = true disable_backup = true user_name = "my_initial_user" password = "thiZ_is_v&ry_s3cret" } resource "random_password" "db_password" { length = 20 special = true upper = true lower = true numeric = true min_upper = 1 min_lower = 1 min_numeric = 1 min_special = 1 override_special = "!@#$%^&*()_+-=[]{}|;:,.<>?" } resource "scaleway_rdb_user" "db_admin" { instance_id = scaleway_rdb_instance.main.id name = "devtools" password = random_password.db_password.result is_admin = true } ``` ### Response #### Success Response (200) - **id** (string) - The ID of the user, which is of the form `{region}/{instance_id}/{user_name}`. ``` -------------------------------- ### Basic scaleway_vpc_ingress_rule Example Source: https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/vpc_ingress_rule This example demonstrates the basic creation of a VPC ingress rule, associating it with a VPC and a private network. ```terraform resource "scaleway_vpc" "vpc01" { name = "my-vpc" } resource "scaleway_vpc_private_network" "pn01" { name = "my-private-network" vpc_id = scaleway_vpc.vpc01.id } resource "scaleway_vpc_ingress_rule" "main" { vpc_id = scaleway_vpc.vpc01.id source = "10.0.0.0/24" nexthop_private_network_id = scaleway_vpc_private_network.pn01.id nexthop_resource_ip = "10.0.0.10" description = "Allow ingress traffic from 10.0.0.0/24" } ``` -------------------------------- ### Example Usage of scaleway_vpc_public_gateway_dhcp_reservation Source: https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/vpc_public_gateway_dhcp_reservation This example demonstrates how to create a private network, an instance server, a public gateway IP, a public gateway DHCP configuration, and a public gateway. It then links them together using a gateway network and finally creates a DHCP reservation for the instance server. ```terraform resource "scaleway_vpc_private_network" "main" { name = "your_private_network" } resource "scaleway_instance_server" "main" { image = "ubuntu_jammy" type = "DEV1-S" zone = "fr-par-1" private_network { pn_id = scaleway_vpc_private_network.main.id } } resource "scaleway_vpc_public_gateway_ip" "main" { } resource "scaleway_vpc_public_gateway_dhcp" "main" { subnet = "192.168.1.0/24" } resource "scaleway_vpc_public_gateway" "main" { name = "foobar" type = "VPC-GW-S" ip_id = scaleway_vpc_public_gateway_ip.main.id } resource "scaleway_vpc_gateway_network" "main" { gateway_id = scaleway_vpc_public_gateway.main.id private_network_id = scaleway_vpc_private_network.main.id dhcp_id = scaleway_vpc_public_gateway_dhcp.main.id cleanup_dhcp = true enable_masquerade = true depends_on = [scaleway_vpc_public_gateway_ip.main, scaleway_vpc_private_network.main] } resource "scaleway_vpc_public_gateway_dhcp_reservation" "main" { gateway_network_id = scaleway_vpc_gateway_network.main.id mac_address = scaleway_instance_server.main.private_network.0.mac_address ip_address = "192.168.1.1" } ``` -------------------------------- ### Scaleway Shared Configuration File Example Source: https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/index An example of a shared configuration file (`config.yaml`) that defines profiles with authentication details and project/organization IDs. ```yaml profiles: myProfile: access_key: xxxxxxxxxxxxxxxxxxxx secret_key: xxxxxxxx-xxx-xxxx-xxxx-xxxxxxxxxxx default_organization_id: xxxxxxxx-xxx-xxxx-xxxx-xxxxxxxxxxx default_project_id: xxxxxxxx-xxx-xxxx-xxxx-xxxxxxxxxxx default_zone: fr-par-2 default_region: fr-par api_url: https://api.scaleway.com insecure: false ``` -------------------------------- ### Example Usage of scaleway_key_manager_verify Source: https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/data-sources/key_manager_verify This example demonstrates how to create a signing key, generate a signature for a message, store the signature in a secret, and then verify that signature using the scaleway_key_manager_verify data source. Ensure the digest is base64 encoded and matches the key's algorithm. ```Terraform resource "scaleway_key_manager_key" "main" { name = "my-kms-key" region = "fr-par" usage = "asymmetric_signing" algorithm = "rsa_pss_2048_sha256" unprotected = true } ephemeral "scaleway_key_manager_sign" "main" { key_id = scaleway_key_manager_key.main.id digest = "base64digest" region = "fr-par" } resource "scaleway_secret" "main" { name = "my-secret" } resource "scaleway_secret_version" "signature" { secret_id = scaleway_secret.main.id data_wo = ephemeral.scaleway_key_manager_sign.main.signature } data "scaleway_secret_version" "signature" { secret_id = scaleway_secret.main.id revision = "1" } data "scaleway_key_manager_verify" "main" { key_id = scaleway_key_manager_key.main.id region = "fr-par" digest = "base64digest" signature = data.scaleway_secret_version.signature.data } ``` -------------------------------- ### Example Usage with an IAM user Source: https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/object_bucket_policy This example demonstrates how to create an Object Storage bucket policy for a specific IAM user. It requires project and user data lookups and defines a policy with specific permissions. ```terraform # Project ID data "scaleway_account_project" "default" { name = "default" } # IAM configuration data "scaleway_iam_user" "user" { email = "user@scaleway.com" } resource "scaleway_iam_policy" "policy" { name = "object-storage-policy" user_id = data.scaleway_iam_user.user.id rule { project_ids = [data.scaleway_account_project.default.id] permission_set_names = ["ObjectStorageFullAccess"] } } ``` -------------------------------- ### Example Usage of scaleway_vpc_public_gateway_pat_rule Source: https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/data-sources/vpc_public_gateway_pat_rule This example demonstrates how to configure a Public Gateway PAT rule and then retrieve its details using the data source. It sets up security groups, servers, private networks, public gateways, and gateway networks before defining the PAT rule and querying it. ```Terraform resource "scaleway_instance_security_group" "sg01" { inbound_default_policy = "drop" outbound_default_policy = "accept" inbound_rule { action = "accept" port = 22 protocol = "TCP" } } resource "scaleway_instance_server" "srv01" { name = "my-server" type = "PLAY2-NANO" image = "ubuntu_jammy" security_group_id = scaleway_instance_security_group.sg01.id } resource "scaleway_instance_private_nic" "pnic01" { server_id = scaleway_instance_server.srv01.id private_network_id = scaleway_vpc_private_network.pn01.id } resource "scaleway_vpc_private_network" "pn01" { name = "my-pn" } resource "scaleway_vpc_public_gateway_dhcp" "dhcp01" { subnet = "192.168.0.0/24" } resource "scaleway_vpc_public_gateway_ip" "ip01" {} resource "scaleway_vpc_public_gateway" "pg01" { name = "my-pg" type = "VPC-GW-S" ip_id = scaleway_vpc_public_gateway_ip.ip01.id } resource "scaleway_vpc_gateway_network" "gn01" { gateway_id = scaleway_vpc_public_gateway.pg01.id private_network_id = scaleway_vpc_private_network.pn01.id dhcp_id = scaleway_vpc_public_gateway_dhcp.dhcp01.id cleanup_dhcp = true enable_masquerade = true } resource "scaleway_vpc_public_gateway_dhcp_reservation" "rsv01" { gateway_network_id = scaleway_vpc_gateway_network.gn01.id mac_address = scaleway_instance_private_nic.pnic01.mac_address ip_address = "192.168.0.7" } resource "scaleway_vpc_public_gateway_pat_rule" "pat01" { gateway_id = scaleway_vpc_public_gateway.pg01.id private_ip = scaleway_vpc_public_gateway_dhcp_reservation.rsv01.ip_address private_port = 22 public_port = 2202 protocol = "tcp" } data "scaleway_vpc_public_gateway_pat_rule" "main" { pat_rule_id = scaleway_vpc_public_gateway_pat_rule.pat01.id } ``` -------------------------------- ### Importing a Snapshot Source: https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/instance_snapshot This example shows how to import an existing snapshot using its zone and ID. ```APIDOC ## Import Snapshots can be imported using the `{zone}/{id}`, e.g. ```terraform terraform import scaleway_instance_snapshot.main fr-par-1/11111111-1111-1111-1111-111111111111 ``` ``` -------------------------------- ### Example Usage of scaleway_object_bucket_website_configuration Source: https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/object_bucket_website_configuration This snippet shows how to configure a basic bucket website with an index document and an error document. ```terraform resource "scaleway_object_bucket" "test" { name = "my-bucket" acl = "public-read" } resource scaleway_object "some_file" { bucket = scaleway_object_bucket.test.name key = "index.html" file = "index.html" visibility = "public-read" content_type = "text/html" } resource "scaleway_object_bucket_website_configuration" "test" { bucket = scaleway_object_bucket.test.name index_document { suffix = "index.html" } error_document { key = "error.html" } } ``` -------------------------------- ### Manage Cockpit in the Scaleway default Project Source: https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/cockpit This example shows how to activate Cockpit in the default Project. ```APIDOC ## Activate Cockpit in the default Project resource "scaleway_cockpit" "main" {} ``` -------------------------------- ### Basic scaleway_vpc Resource Source: https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/vpc Creates a basic Scaleway VPC with a name and tags. This is a fundamental example for setting up a VPC. ```terraform resource "scaleway_vpc" "vpc01" { name = "my-vpc" tags = ["demo", "terraform"] } ``` -------------------------------- ### BareMetal Server with Custom Partitioning Source: https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/data-sources/baremetal_partition_schema This example demonstrates how to provision a BareMetal server using a custom partitioning schema obtained from the `scaleway_baremetal_easy_partitioning` data source, which itself uses offer and OS details. ```terraform data "scaleway_baremetal_offer" "my_offer" { zone = "fr-par-1" name = "EM-B220E-NVME" } data "scaleway_baremetal_os" "my_os" { zone = "fr-par-1" name = "Ubuntu" version = "22.04 LTS (Jammy Jellyfish)" } resource "scaleway_iam_ssh_key" "main" { name = "my-ssh-key" public_key = "my-ssh-key-public" } data "scaleway_baremetal_easy_partitioning" "test" { offer_id = data.scaleway_baremetal_offer.my_offer.offer_id os_id = data.scaleway_baremetal_os.my_os.os_id swap = false ext_4_mountpoint = "/hello" } resource "scaleway_baremetal_server" "base" { name = "my-baremetal-server" zone = "fr-par-1" description = "test a description" offer = data.scaleway_baremetal_offer.my_offer.offer_id os = data.scaleway_baremetal_os.my_os.os_id partitioning = data.scaleway_baremetal_easy_partitioning.test.json_partition tags = ["terraform-test", "scaleway_baremetal_server", "minimal", "edited"] ssh_key_ids = [scaleway_iam_ssh_key.main.id] } ``` -------------------------------- ### scaleway_instance_server_type Source: https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/data-sources/instance_server_type Example of how to use the scaleway_instance_server_type data source to get information about a specific server type. ```APIDOC ## scaleway_instance_server_type Gets information about a server type. ### Example Usage ``` data "scaleway_instance_server_type" "pro2_s" { name = "PRO2-S" zone = "nl-ams-1" } ``` ### Argument Reference To select the server type which information should be fetched, the following arguments can be used: * `name` - (Required) The name of the server type. Only one of `name` and `snapshot_id` should be specified. * `zone` - (Defaults to provider `zone`) The zone of the server type (to check the availability of the server type for example). ### Attributes Reference The following attributes will be available: * `arch` - The architecture of the server type. * `cpu` - The number of CPU cores of the server type. * `ram` - The amount of RAM of the server type (in bytes). * `gpu` - The number of GPUs of the server type. * `volumes` - The specifications of volumes allowed for the server type. * `min_size_total` - The minimum total size in bytes of volumes allowed on the server type. * `max_size_total` - The maximum total size in bytes of volumes allowed on the server type. * `min_size_per_local_volume` - The minimum size in bytes per local volume allowed on the server type. * `max_size_per_local_volume` - The maximum size in bytes per local volume allowed on the server type. * `scratch_storage_max_size` - The maximum size in bytes of the scratch volume allowed on the server type. * `block_storage` - Whether block storage is allowed on the server type. * `capabilities` - The specific capabilities of the server type. * `boot_types` - The boot types allowed for the server type. * `max_file_systems` - The maximum number of file systems that can be attached on the server type. * `network` - The network specifications of the server type. * `internal_bandwidth` - The internal bandwidth of the server type (in bytes/second). * `public_bandwidth` - The public bandwidth of the server type (in bytes/second). * `block_bandwidth` - The block bandwidth of the server type (in bytes/second). * `hourly_price` - The hourly price of the server type (in euros). * `monthly_price` - The monthly price of the server type (in euros). * `end_of_service` - Whether the server type will soon reach End Of Service. * `availability` - Whether the server type is available in the zone. ``` -------------------------------- ### List VPCs filtered by name prefix Source: https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/list-resources/vpc This example shows how to list VPCs in all regions whose names start with a specific prefix. ```APIDOC ## list "scaleway_vpc" "by_name" ### Description Lists VPCs across all regions filtered by a name prefix. ### Arguments #### config - `regions` (Optional) - Regions to filter for. Use `["*"]` to list from all regions. - `name` (Optional) - Name of the VPC to filter for. ### Example Usage ```hcl list "scaleway_vpc" "by_name" { provider = scaleway config { regions = ["*"] name = "test-vpc" } } ``` ``` -------------------------------- ### Bare Metal Server with Cloud-Init Source: https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/baremetal_server This example demonstrates provisioning a bare metal server with custom configuration using cloud-init. It references a `userdata.yaml` file for the cloud-init data. Ensure the `userdata.yaml` file exists and is correctly formatted. ```terraform data "scaleway_iam_ssh_key" "my_ssh_key" { name = "main" } data "scaleway_baremetal_os" "my_os" { zone = "fr-par-1" name = "Ubuntu" version = "22.04 LTS (Jammy Jellyfish)" } data "scaleway_baremetal_offer" "my_offer" { zone = "fr-par-2" name = "EM-I220E-NVME" } resource "scaleway_baremetal_server" "my_server_ci" { zone = "fr-par-2" offer = data.scaleway_baremetal_offer.my_offer.offer_id os = data.scaleway_baremetal_os.my_os.os_id ssh_key_ids = [data.scaleway_iam_ssh_key.my_ssh_key.id] cloud_init = file("userdata.yaml") } ``` -------------------------------- ### Get Private NIC by Tags Source: https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/data-sources/instance_private_nic Use this example to find a private NIC associated with a specific server by its tags. The search using tags must yield only one result. ```terraform data "scaleway_instance_private_nic" "by_tags" { server_id = "11111111-1111-1111-1111-111111111111" tags = ["mytag"] } ``` -------------------------------- ### Importing a Local Qcow2 File as a Snapshot Source: https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/instance_snapshot This example demonstrates how to import a local qcow2 file from an object storage bucket to create an instance snapshot. ```APIDOC ## scaleway_instance_snapshot snapshot (import) ### Description Imports a snapshot from a qcow2 file located in a bucket. ### Method resource "scaleway_instance_snapshot" "snapshot" ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **import** (Object) - Required - Configuration for importing the snapshot. - **bucket** (String) - Required - Bucket name containing qcow2 to import. - **key** (String) - Required - Key of the object to import. ### Request Example ```terraform resource "scaleway_object_bucket" "bucket" { name = "snapshot-qcow-import" } resource "scaleway_object" "qcow" { bucket = scaleway_object_bucket.bucket.name key = "server.qcow2" file = "myqcow.qcow2" } resource "scaleway_instance_snapshot" "snapshot" { import { bucket = scaleway_object.qcow.bucket key = scaleway_object.qcow.key } } ``` ### Response #### Success Response (200) - **id** (String) - The ID of the snapshot. #### Response Example ```json { "id": "fr-par-1/abcdef12-3456-7890-abcd-ef1234567890" } ``` ``` -------------------------------- ### Get Cockpit Exporter by Name and Project Source: https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/data-sources/cockpit_exporter This example shows how to fetch a Cockpit exporter by specifying its `project_id` and `name`. This is useful when you don't have the exporter's full ID but know its project and name. ```terraform data "scaleway_cockpit_exporter" "main" { project_id = "11111111-1111-1111-1111-111111111111" name = "my-datadog-exporter" } ``` -------------------------------- ### Get Cockpit Configuration and Use Retention Defaults Source: https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/data-sources/cockpit_config Use this data source to retrieve regional Cockpit configuration. It's helpful for validating `retention_days` before creating or updating `scaleway_cockpit_source` resources. The example shows how to fetch the configuration and use the default custom metrics retention days. ```terraform data "scaleway_cockpit_config" "main" { region = "fr-par" } resource "scaleway_cockpit_source" "metrics" { name = "my-metrics" type = "metrics" retention_days = data.scaleway_cockpit_config.main.custom_metrics_retention[0].default_days } output "custom_metrics_retention_bounds" { value = data.scaleway_cockpit_config.main.custom_metrics_retention[0] } ``` -------------------------------- ### Example Usage: Scaleway VPC Route with Instance Source: https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/vpc_route Demonstrates creating a VPC route with an instance as the next hop. Ensure the instance and its private network are configured correctly. ```terraform resource "scaleway_vpc" "vpc01" { name = "tf-vpc-vpn" } resource "scaleway_vpc_private_network" "pn01" { name = "tf-pn-vpn" ipv4_subnet { subnet = "172.16.64.0/22" } vpc_id = scaleway_vpc.vpc01.id } resource "scaleway_instance_server" "server01" { name = "tf-server-vpn" type = "PLAY2-MICRO" image = "openvpn" } resource "scaleway_instance_private_nic" "pnic01" { private_network_id = scaleway_vpc_private_network.pn01.id server_id = scaleway_instance_server.server01.id } resource "scaleway_vpc_route" "rt01" { vpc_id = scaleway_vpc.vpc01.id description = "tf-route-vpn" tags = ["tf", "route"] destination = "10.0.0.0/24" nexthop_resource_id = scaleway_instance_private_nic.pnic01.id } ``` -------------------------------- ### Baremetal Server Without Install Config Source: https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/baremetal_server Provision a baremetal server without an immediate OS installation. This is useful when you plan to install the OS manually or at a later stage. ```terraform data "scaleway_baremetal_offer" "my_offer" { zone = "fr-par-2" name = "EM-B112X-SSD" } resource "scaleway_baremetal_server" "my_server" { zone = "fr-par-2" offer = data.scaleway_baremetal_offer.my_offer.offer_id install_config_afterward = true } ``` -------------------------------- ### scaleway_vpc_public_gateway_pat_rule Data Source Example Source: https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/data-sources/vpc_public_gateway_pat_rule Example usage of the `scaleway_vpc_public_gateway_pat_rule` data source to retrieve details of a PAT rule. ```APIDOC ## Data Source: scaleway_vpc_public_gateway_pat_rule Gets information about a Public Gateway PAT rule. ### Example Usage ``` data "scaleway_vpc_public_gateway_pat_rule" "main" { pat_rule_id = scaleway_vpc_public_gateway_pat_rule.pat01.id } ``` ## Argument Reference * `pat_rule_id` - (Required) The ID of the PAT rule to retrieve. * `zone` - (Defaults to provider `zone`) The zone in which the rule exists. ## Attributes Reference `id` is set to the ID of the retrieved Public Gateway PAT rule. Public Gateway PAT rule IDs are zoned, which means they are of the form `{zone}/{id}`, e.g. `fr-par-1/11111111-1111-1111-1111-111111111111`. The following arguments are exported: * `gateway_id` - The ID of the Public Gateway. * `private_ip` - The private IP address to forward data to. * `public_port` - The public port to listen on. * `private_port` - The private port to translate to. * `protocol` - The protocol the rule should apply to. Possible values are `both`, `tcp` and `udp`. ``` -------------------------------- ### Baremetal Server with Options Source: https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/baremetal_server Example of provisioning a baremetal server with specific options like private network and remote access. ```terraform data "scaleway_iam_ssh_key" "my_ssh_key" { name = "main" public_key = "ssh XXXXXXXXXXX" } data "scaleway_baremetal_os" "my_os" { zone = "fr-par-2" name = "Ubuntu" version = "22.04 LTS (Jammy Jellyfish)" } data "scaleway_baremetal_offer" "my_offer" { zone = "fr-par-2" name = "EM-B112X-SSD" } data "scaleway_baremetal_option" "private_network" { zone = "fr-par-2" name = "Private Network" } data "scaleway_baremetal_option" "remote_access" { zone = "fr-par-2" name = "Remote Access" } resource "scaleway_baremetal_server" "base" { zone = "fr-par-2" offer = data.scaleway_baremetal_offer.my_offer.offer_id os = data.scaleway_baremetal_os.my_os.os_id ssh_key_ids = [data.scaleway_iam_ssh_key.my_ssh_key.id] options { id = data.scaleway_baremetal_option.private_network.option_id } options { id = data.scaleway_baremetal_option.remote_access.option_id } } ``` -------------------------------- ### Basic usage Source: https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/data-sources/cockpit_preconfigured_alert This example demonstrates how to use the `scaleway_cockpit_preconfigured_alert` data source to fetch all available preconfigured alerts and output their details. ```APIDOC ## Data Source: scaleway_cockpit_preconfigured_alert Gets information about preconfigured alert rules available in Scaleway Cockpit. Preconfigured alerts are ready-to-use alert rules that monitor common metrics for Scaleway services. You can enable these alerts in your Alert Manager using the `scaleway_cockpit_alert_manager` resource. For more information, refer to Cockpit's product documentation and API documentation. ### Example Usage #### Basic usage ```hcl data "scaleway_cockpit_preconfigured_alert" "main" { project_id = scaleway_account_project.project.id } output "available_alerts" { value = data.scaleway_cockpit_preconfigured_alert.main.alerts } ``` ### Filter by status ```hcl data "scaleway_cockpit_preconfigured_alert" "enabled" { project_id = scaleway_account_project.project.id rule_status = "enabled" } data "scaleway_cockpit_preconfigured_alert" "disabled" { project_id = scaleway_account_project.project.id rule_status = "disabled" } ``` ### Use with Alert Manager ```hcl resource "scaleway_account_project" "project" { name = "my-observability-project" } resource "scaleway_cockpit" "main" { project_id = scaleway_account_project.project.id } data "scaleway_cockpit_preconfigured_alert" "all" { project_id = scaleway_cockpit.main.project_id } resource "scaleway_cockpit_alert_manager" "main" { project_id = scaleway_cockpit.main.project_id # Enable specific alerts by their preconfigured_rule_id preconfigured_alert_ids = [ for alert in data.scaleway_cockpit_preconfigured_alert.all.alerts : alert.preconfigured_rule_id if alert.product_name == "instance" && alert.rule_status == "disabled" ] contact_points { email = "alerts@example.com" } } ``` ## Argument Reference * `project_id` - (Optional) The ID of the project the alerts are associated with. If not provided, the default project configured in the provider is used. * `region` - (Optional, defaults to provider region) The region in which the alerts exist. * `data_source_id` - (Optional) Filter alerts by data source ID. * `rule_status` - (Optional) Filter alerts by rule status. Valid values are `enabled` or `disabled`. ## Attributes Reference In addition to all arguments above, the following attributes are exported: * `id` - The ID of the resource (project ID with region). * `alerts` - List of preconfigured alerts. Each alert contains: * `name` - Name of the alert rule. * `rule` - PromQL expression defining the alert condition. * `duration` - Duration for which the condition must be true before the alert fires (e.g., "5m"). * `rule_status` - Status of the alert rule (`enabled`, `disabled`, `enabling`, `disabling`). * `state` - Current state of the alert (`inactive`, `pending`, `firing`). * `annotations` - Map of annotations attached to the alert. * `preconfigured_rule_id` - Unique identifier of the preconfigured rule. Use this ID in `scaleway_cockpit_alert_manager` resource. * `display_name` - Human-readable name of the alert. * `display_description` - Human-readable description of the alert. * `product_name` - Scaleway product associated with the alert (e.g., "instance", "rdb", "kubernetes"). * `product_family` - Family of the product (e.g., "compute", "storage", "network"). * `data_source_id` - ID of the data source containing the alert rule. ``` -------------------------------- ### scaleway_key_manager_key Data Source Example Source: https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/data-sources/key_manager_key Example usage for the scaleway_key_manager_key data source to retrieve key information by its ID. ```APIDOC ## Data Source: scaleway_key_manager_key Gets information about a Key Manager Key. For more information, refer to the Key Manager API documentation. ### Example Usage #### Create a key and get its information The following commands allow you to: * create a key named `my-kms-key` * retrieve the key's information using the key's ID ```terraform # Create a key resource "scaleway_key_manager_key" "symmetric" { name = "my-kms-key" region = "fr-par" project_id = "your-project-id" # optional, will use provider default if omitted usage = "symmetric_encryption" algorithm = "aes_256_gcm" description = "Key for encrypting secrets" tags = ["env:prod", "kms"] unprotected = true rotation_policy { rotation_period = "720h" # 30 days } } # Get the key information by its ID data "scaleway_key_manager_key" "byID" { key_id = "11111111-1111-1111-1111-111111111111" } ``` ## Argument Reference * `key_id` - (Required) ID of the key to target. Can be a plain UUID or a regional ID. * `region` - (Optional) The region in which the key was created. Defaults to the provider `region`. ## Attributes Reference Exported attributes are the ones from `scaleway_key_manager_key` resource ``` -------------------------------- ### Create DHCP Reservation and Retrieve by ID Source: https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/data-sources/vpc_public_gateway_dhcp_reservation This example demonstrates creating a DHCP reservation with a static IP address and then retrieving it using its reservation ID. It also shows how to set up a PAT rule associated with this reservation. ```terraform resource "scaleway_vpc_private_network" "main" {} resource "scaleway_instance_security_group" "main" { inbound_default_policy = "drop" outbound_default_policy = "accept" inbound_rule { action = "accept" port = "22" } } resource "scaleway_instance_server" "main" { image = "ubuntu_jammy" type = "DEV1-S" zone = "fr-par-1" security_group_id = scaleway_instance_security_group.main.id } resource "scaleway_instance_private_nic" "main" { server_id = scaleway_instance_server.main.id private_network_id = scaleway_vpc_private_network.main.id } resource "scaleway_vpc_public_gateway_ip" "main" { } resource "scaleway_vpc_public_gateway_dhcp" "main" { subnet = "192.168.1.0/24" } resource "scaleway_vpc_public_gateway" "main" { name = "foobar" type = "VPC-GW-S" ip_id = scaleway_vpc_public_gateway_ip.main.id } resource "scaleway_vpc_gateway_network" "main" { gateway_id = scaleway_vpc_public_gateway.main.id private_network_id = scaleway_vpc_private_network.main.id dhcp_id = scaleway_vpc_public_gateway_dhcp.main.id cleanup_dhcp = true enable_masquerade = true } resource "scaleway_vpc_public_gateway_dhcp_reservation" "main" { gateway_network_id = scaleway_vpc_gateway_network.main.id mac_address = scaleway_instance_private_nic.main.mac_address ip_address = "192.168.1.4" } ### VPC PAT RULE resource "scaleway_vpc_public_gateway_pat_rule" "main" { gateway_id = scaleway_vpc_public_gateway.main.id private_ip = scaleway_vpc_public_gateway_dhcp_reservation.main.ip_address private_port = 22 public_port = 2222 protocol = "tcp" } data "scaleway_vpc_public_gateway_dhcp_reservation" "by_id" { reservation_id = scaleway_vpc_public_gateway_dhcp_reservation.main.id } ``` -------------------------------- ### Basic creation of an inference model Source: https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/inference_model This example demonstrates the basic creation of an inference model using the `scaleway_inference_model` resource. ```APIDOC ## Resource: scaleway_inference_model The scaleway_inference_model resource allows you to upload and manage inference models in the Scaleway Inference ecosystem. Once registered, a model can be used in any scaleway_inference_deployment resource. ### Arguments * `name` - (Required) The name of the model. This must be unique within the project. * `url` - (Required) The HTTPS source URL from which the model will be downloaded. This is typically a Hugging Face repository URL (e.g., https://huggingface.co/agentica-org/DeepCoder-14B-Preview). The URL must be publicly accessible or require valid credentials via `secret` or `secret_wo` * `secret` - (Optional, Sensitive) Authentication token used to pull the model from a private or gated URL (e.g., a Hugging Face access token with read permission). Conflicts with `secret_wo`. * `secret_wo` - (Optional) Authentication token used to pull the model from a private or gated URL in write-only mode. `secret_wo` will not be stored in the Terraform state. Only one of `secret` or `secret_wo` should be specified. Requires `secret_wo_version` to be set. * `secret_wo_version` - (Optional) The version of the write-only secret. Required when using `secret_wo`. * `region` - (Defaults to provider `region`) The region in which the deployment is created. * `project_id` - (Defaults to provider `project_id`) The ID of the project the deployment is associated with. ### Example Usage ```hcl resource "scaleway_inference_model" "test" { name = "my-awesome-model" url = "https://huggingface.co/agentica-org/DeepCoder-14B-Preview" secret = "my-secret-token" } ``` ```