### Create Baremetal Server Without Install Config Source: https://github.com/scaleway/terraform-provider-scaleway/blob/main/docs/resources/baremetal_server.md This example demonstrates creating a baremetal server where the installation configuration will be applied later. Set `install_config_afterward` to `true` to defer the installation. ```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 } ``` -------------------------------- ### Example Usage Source: https://github.com/scaleway/terraform-provider-scaleway/blob/main/docs/resources/object_bucket_website_configuration.md Basic example of setting up a bucket website configuration. ```APIDOC ## Example Usage ```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" } } ``` ``` -------------------------------- ### Complete Cockpit and Grafana Setup Source: https://github.com/scaleway/terraform-provider-scaleway/blob/main/docs/data-sources/cockpit_grafana.md This example demonstrates setting up a Scaleway project, Cockpit instance, and then retrieving Grafana connection information. The output includes the Grafana URL and project ID. ```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" } ``` -------------------------------- ### Example Usage with a bucket policy Source: https://github.com/scaleway/terraform-provider-scaleway/blob/main/docs/resources/object_bucket_website_configuration.md Example demonstrating bucket website configuration alongside a bucket policy. ```APIDOC ## Example Usage with a bucket policy ```terraform resource "scaleway_object_bucket" "main" { name = "MyBucket" acl = "public-read" } resource "scaleway_object_bucket_policy" "main" { bucket = scaleway_object_bucket.main.id policy = jsonencode( { "Version" = "2012-10-17", "Id" = "MyPolicy", "Statement" = [ { "Sid" = "GrantToEveryone", "Effect" = "Allow", "Principal" = "*", "Action" = [ "s3:GetObject" ], "Resource" : [ "/*" ] } ] }) } resource "scaleway_object_bucket_website_configuration" "main" { bucket = scaleway_object_bucket.main.id index_document { suffix = "index.html" } } ``` ``` -------------------------------- ### Example Usage Source: https://github.com/scaleway/terraform-provider-scaleway/blob/main/docs/resources/object_bucket_acl.md Basic example of creating a bucket and setting its ACL to private. ```APIDOC ## Example Usage ```terraform resource "scaleway_object_bucket" "some_bucket" { name = "unique-name" } resource "scaleway_object_bucket_acl" "main" { bucket = scaleway_object_bucket.main.id acl = "private" } ``` For more information, refer to the [PutBucketAcl API call documentation](https://www.scaleway.com/en/docs/object-storage/api-cli/bucket-operations/#putbucketacl). ``` -------------------------------- ### Example Usage of scaleway_lb_backend Data Source Source: https://github.com/scaleway/terraform-provider-scaleway/blob/main/docs/data-sources/lb_backend.md This example demonstrates how to create a load balancer, a backend, and then use the `scaleway_lb_backend` data source to retrieve information about the created backend by both ID and by name. ```hcl resource "scaleway_lb_ip" "main" { } resource "scaleway_lb" "main" { ip_id = scaleway_lb_ip.main.id name = "data-test-lb-backend" type = "LB-S" } resource "scaleway_lb_backend" "main" { lb_id = scaleway_lb.main.id name = "backend01" forward_protocol = "http" forward_port = "80" } data "scaleway_lb_backend" "byID" { backend_id = scaleway_lb_backend.main.id } data "scaleway_lb_backend" "byName" { name = scaleway_lb_backend.main.name lb_id = scaleway_lb.main.id } ``` -------------------------------- ### Example Usage: Basic Snapshot Source: https://github.com/scaleway/terraform-provider-scaleway/blob/main/docs/resources/rdb_snapshot.md Example of creating a basic RDB snapshot for a given instance. ```APIDOC ### Example Basic Snapshot ```terraform resource "scaleway_rdb_instance" "main" { name = "test-rdb-instance" node_type = "db-dev-s" engine = "PostgreSQL-15" is_ha_cluster = false disable_backup = true user_name = "my_initial_user" password = "thiZ_is_v&ry_s3cret" tags = ["terraform-test", "scaleway_rdb_instance", "minimal"] volume_type = "sbs_5k" volume_size_in_gb = 10 } resource "scaleway_rdb_snapshot" "test" { name = "initial-snapshot" instance_id = scaleway_rdb_instance.main.id depends_on = [scaleway_rdb_instance.main] } ``` ``` -------------------------------- ### Example Usage: Multiple Snapshots Source: https://github.com/scaleway/terraform-provider-scaleway/blob/main/docs/resources/rdb_snapshot.md Example demonstrating the creation of multiple RDB snapshots. ```APIDOC ### Example with Multiple Snapshots ```terraform resource "scaleway_rdb_snapshot" "snapshot_a" { name = "snapshot_a" instance_id = scaleway_rdb_instance.main.id depends_on = [scaleway_rdb_instance.main] } resource "scaleway_rdb_snapshot" "snapshot_b" { name = "snapshot_b" instance_id = scaleway_rdb_instance.main.id expires_at = "2025-02-07T00:00:00Z" depends_on = [scaleway_rdb_instance.main] } ``` ``` -------------------------------- ### Complete scaleway_tem_webhook Example with Dependencies Source: https://github.com/scaleway/terraform-provider-scaleway/blob/main/docs/resources/tem_webhook.md A comprehensive example showcasing the `scaleway_tem_webhook` resource along with its dependencies, including SNS topic creation and domain validation. This setup is useful for a fully integrated email sending and notification system. ```terraform variable "domain_name" { type = string } resource "scaleway_mnq_sns" "sns" { } resource "scaleway_mnq_sns_credentials" "sns_credentials" { permissions { can_manage = true } } resource "scaleway_mnq_sns_topic" "sns_topic" { name = "test-mnq-sns-topic-basic" access_key = scaleway_mnq_sns_credentials.sns_credentials.access_key secret_key = scaleway_mnq_sns_credentials.sns_credentials.secret_key } resource "scaleway_tem_domain" "cr01" { name = var.domain_name accept_tos = true } resource "scaleway_domain_record" "spf" { dns_zone = var.domain_name type = "TXT" data = "v=spf1 ${scaleway_tem_domain.cr01.spf_config} -all" } resource "scaleway_domain_record" "dkim" { dns_zone = var.domain_name name = "${scaleway_tem_domain.cr01.project_id}._domainkey" type = "TXT" data = scaleway_tem_domain.cr01.dkim_config } resource "scaleway_domain_record" "mx" { dns_zone = var.domain_name type = "MX" data = "." } resource "scaleway_domain_record" "dmarc" { dns_zone = var.domain_name name = scaleway_tem_domain.cr01.dmarc_name type = "TXT" data = scaleway_tem_domain.cr01.dmarc_config } resource "scaleway_tem_domain_validation" "valid" { domain_id = scaleway_tem_domain.cr01.id region = scaleway_tem_domain.cr01.region timeout = 3600 } resource "scaleway_tem_webhook" "webhook" { name = "example-webhook" domain_id = scaleway_tem_domain.cr01.id event_types = ["email_delivered", "email_bounced"] sns_arn = scaleway_mnq_sns_topic.sns_topic.arn depends_on = [scaleway_tem_domain_validation.valid, scaleway_mnq_sns_topic.sns_topic] } ``` -------------------------------- ### Example Usage with Grants Source: https://github.com/scaleway/terraform-provider-scaleway/blob/main/docs/resources/object_bucket_acl.md Example demonstrating how to configure granular access control using grants. ```APIDOC ## Example Usage with Grants ```terraform resource "scaleway_object_bucket" "main" { name = "your-bucket" } resource "scaleway_object_bucket_acl" "main" { bucket = scaleway_object_bucket.main.id access_control_policy { grant { grantee { id = ":" type = "CanonicalUser" } permission = "FULL_CONTROL" } grant { grantee { id = "" type = "CanonicalUser" } permission = "WRITE" } owner { id = "" } } } ``` ``` -------------------------------- ### Complete scaleway_container_domain Example with Domain Record Source: https://github.com/scaleway/terraform-provider-scaleway/blob/main/docs/resources/container_domain.md This example demonstrates a more complete setup, including creating a container namespace, a container, and a DNS CNAME record before binding the domain to the container. Ensure the CNAME record's data includes a trailing dot. ```terraform resource "scaleway_container_namespace" "main" {} resource "scaleway_container" "app" { name = "app" namespace_id = scaleway_container_namespace.main.id image = "nginx:latest" port = 80 privacy = "public" protocol = "http1" } resource "scaleway_domain_record" "app" { dns_zone = "scaleway-terraform.com" name = "subdomain" type = "CNAME" data = format("%s.", trimprefix("${scaleway_container.app.public_endpoint}", "https://")) // Trailing dot is important in CNAME ttl = 3600 } resource "scaleway_container_domain" "app" { container_id = scaleway_container.app.id hostname = "${scaleway_domain_record.app.name}.${scaleway_domain_record.app.dns_zone}" } ``` -------------------------------- ### Create DHCP Reservation and Retrieve by ID Source: https://github.com/scaleway/terraform-provider-scaleway/blob/main/docs/data-sources/vpc_public_gateway_dhcp_reservation.md This example demonstrates creating a static DHCP reservation with a specific IP address and then retrieving it using its reservation ID. It also includes the setup for a PAT rule. Ensure all prerequisite resources like private networks, gateway networks, and public gateways are configured. ```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 } ``` -------------------------------- ### Example Usage: Basic Private NIC Source: https://github.com/scaleway/terraform-provider-scaleway/blob/main/docs/resources/instance_private_nic.md A basic example demonstrating how to create a private NIC and attach it to a server and a private network. ```APIDOC ### Basic Usage ```terraform resource "scaleway_instance_private_nic" "pnic01" { server_id = "fr-par-1/11111111-1111-1111-1111-111111111111" private_network_id = "fr-par-1/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa" } ``` ``` -------------------------------- ### Example Usage: Private NIC with Zone Source: https://github.com/scaleway/terraform-provider-scaleway/blob/main/docs/resources/instance_private_nic.md An example showing how to create a private NIC in a specific zone, ensuring it aligns with the server and private network's zone. ```APIDOC ### With Zone ```terraform resource "scaleway_vpc_private_network" "pn01" { name = "private_network_instance" region = "fr-par" } resource "scaleway_instance_server" "base" { image = "ubuntu_jammy" type = "DEV1-S" zone = scaleway_vpc_private_network.pn01.zone } resource "scaleway_instance_private_nic" "pnic01" { server_id = scaleway_instance_server.base.id private_network_id = scaleway_vpc_private_network.pn01.id zone = scaleway_vpc_private_network.pn01.zone } ``` ``` -------------------------------- ### Create and Get Scaleway Load Balancer Certificate Source: https://github.com/scaleway/terraform-provider-scaleway/blob/main/docs/data-sources/lb_certificate.md This example demonstrates how to create a Load Balancer, attach a Let's Encrypt certificate to it, and then retrieve certificate information using both ID and name. Ensure the `scaleway_lb_ip` and `scaleway_lb` resources are defined before creating the certificate. ```hcl resource "scaleway_lb_ip" "main" { } resource "scaleway" "main" { ip_id = scaleway_lb_ip.main.id name = "data-test-lb-cert" type = "LB-S" } resource "scaleway_lb_certificate" "main" { lb_id = scaleway_lb.main.id name = "data-test-lb-cert" letsencrypt { common_name = "${replace(scaleway_lb.main.ip_address, ".", "-")}.lb.${scaleway_lb.main.region}.scw.cloud" } } data "scaleway_lb_certificate" "byID" { certificate_id = "${scaleway_lb_certificate.main.id}" } data "scaleway_lb_certificate" "byName" { name = "${scaleway_lb_certificate.main.name}" lb_id = "${scaleway_lb.main.id}" } ``` -------------------------------- ### Example Usage of scaleway_key_manager_verify Source: https://github.com/scaleway/terraform-provider-scaleway/blob/main/docs/data-sources/key_manager_verify.md This example demonstrates how to create a key, generate a signature, store it, and then verify it 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 of scaleway_mongodb_databases Source: https://github.com/scaleway/terraform-provider-scaleway/blob/main/docs/data-sources/mongodb_databases.md 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. ```terraform 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] } ``` -------------------------------- ### Basic scaleway_iot_hub Source: https://github.com/scaleway/terraform-provider-scaleway/blob/main/docs/resources/iot_hub.md This is a basic example of how to create an IoT Hub instance. Ensure you have the correct product plan specified. ```terraform resource "scaleway_iot_hub" "main" { name = "test-iot" product_plan = "plan_shared" } ``` -------------------------------- ### Example Usage of scaleway_vpc_public_gateway_dhcp_reservation Source: https://github.com/scaleway/terraform-provider-scaleway/blob/main/docs/resources/vpc_public_gateway_dhcp_reservation.md This example demonstrates how to create a private network, an instance server, a public gateway IP, a DHCP configuration, a public gateway, and a gateway network, before finally creating a DHCP reservation for the instance server. Ensure that the IP address falls within the subnet configured for the DHCP server and outside the dynamic range. ```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" } ``` -------------------------------- ### Create a Kafka Cluster with Tags Source: https://github.com/scaleway/terraform-provider-scaleway/blob/main/docs/resources/kafka_cluster.md This example shows how to create a Scaleway Kafka cluster and apply tags for organization. Similar to the basic example, it requires pre-existing VPC and private network resources. Tags can help categorize clusters for management. ```terraform resource "scaleway_vpc" "main" { region = "fr-par" name = "my-vpc" } resource "scaleway_vpc_private_network" "pn" { name = "my-private-network" region = "fr-par" vpc_id = scaleway_vpc.main.id } resource "scaleway_kafka_cluster" "main" { name = "my-kafka-cluster" version = "3.9.0" node_amount = 1 node_type = "KAFK-PLAY-NANO" volume_type = "sbs_5k" volume_size_in_gb = 10 user_name = "admin" password = "thiZ_is_v&ry_s3cret" tags = ["production", "messaging"] private_network { pn_id = scaleway_vpc_private_network.pn.id } } ``` -------------------------------- ### Basic Scaleway S2S VPN Connection Example Source: https://github.com/scaleway/terraform-provider-scaleway/blob/main/docs/resources/s2s_vpn_connection.md This example demonstrates how to create a basic Site-to-Site VPN connection using Terraform. It includes the necessary VPC, private network, VPN gateway, customer gateway, and routing policy resources. ```terraform resource "scaleway_vpc" "vpc" { name = "my-vpc" } resource "scaleway_vpc_private_network" "pn" { name = "my-private-network" vpc_id = scaleway_vpc.vpc.id ipv4_subnet { subnet = "10.0.1.0/24" } } resource "scaleway_s2s_vpn_gateway" "gateway" { name = "my-vpn-gateway" gateway_type = "VGW-S" private_network_id = scaleway_vpc_private_network.pn.id } resource "scaleway_s2s_vpn_customer_gateway" "customer_gw" { name = "my-customer-gateway" ipv4_public = "203.0.113.1" asn = 65000 } resource "scaleway_s2s_vpn_routing_policy" "policy" { name = "my-routing-policy" prefix_filter_in = ["10.0.2.0/24"] prefix_filter_out = ["10.0.1.0/24"] } resource "scaleway_s2s_vpn_connection" "main" { name = "my-vpn-connection" vpn_gateway_id = scaleway_s2s_vpn_gateway.gateway.id customer_gateway_id = scaleway_s2s_vpn_customer_gateway.customer_gw.id initiation_policy = "customer_gateway" enable_route_propagation = true bgp_config_ipv4 { routing_policy_id = scaleway_s2s_vpn_routing_policy.policy.id private_ip = "169.254.0.1/30" peer_private_ip = "169.254.0.2/30" } ikev2_ciphers { encryption = "aes256" integrity = "sha256" dh_group = "modp2048" } esp_ciphers { encryption = "aes256" integrity = "sha256" dh_group = "modp2048" } } ``` -------------------------------- ### BareMetal Server with Easy Partitioning Source: https://github.com/scaleway/terraform-provider-scaleway/blob/main/docs/data-sources/baremetal_partition_schema.md This example demonstrates provisioning a BareMetal server using data sources for offer, OS, and SSH key, along with the easy partitioning data source to define the disk layout. The partitioning is directly applied to the server resource. ```hcl 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] } ``` -------------------------------- ### Get Interlink Dedicated Connection by Name Source: https://github.com/scaleway/terraform-provider-scaleway/blob/main/docs/data-sources/interlink_dedicated_connection.md This example demonstrates how to retrieve a dedicated connection by its name. ```APIDOC ## Get Interlink Dedicated Connection by Name ### Description Retrieves information about a specific Interlink Dedicated Connection using its name. ### Method GET ### Endpoint `/interlink/v1/dedicated_connections` ### Parameters #### Query Parameters - **name** (string) - Required - The name of the dedicated connection to filter for. - **region** (string) - Optional - The region where the dedicated connection is located. Defaults to the provider's region. ### Response #### Success Response (200) - **id** (string) - The ID of the dedicated connection. - **status** (string) - The current status of the dedicated connection. - **tags** (array) - A list of tags associated with the connection. - **pop_id** (string) - The ID of the Point of Presence (PoP) where the connection is established. - **bandwidth_mbps** (integer) - The bandwidth of the connection in Mbps. - **available_link_bandwidths** (array) - A list of supported link bandwidths for this connection. - **demarcation_info** (object) - Information required by the data center for Cross Connect setup. - **customer_access_point** (string) - Customer access point details. - **provider_access_point** (string) - Provider access point details. - **vlan_range** (object) - The VLAN range allocated for self-hosted links. - **start** (integer) - The starting VLAN ID. - **end** (integer) - The ending VLAN ID. - **project_id** (string) - The ID of the project this connection belongs to. - **organization_id** (string) - The ID of the organization this connection belongs to. - **created_at** (string) - The creation date of the connection in RFC 3339 format. - **updated_at** (string) - The last modification date of the connection in RFC 3339 format. ### Response Example ```json { "id": "11111111-1111-1111-1111-111111111111", "status": "available", "tags": ["production", "network"], "pop_id": "aaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa", "bandwidth_mbps": 1000, "available_link_bandwidths": [ {"min_bandwidth_mbps": 100, "max_bandwidth_mbps": 1000}, {"min_bandwidth_mbps": 500, "max_bandwidth_mbps": 1000} ], "demarcation_info": { "customer_access_point": "Rack 1, Unit 5", "provider_access_point": "Patch Panel A, Port 12" }, "vlan_range": { "start": 100, "end": 199 }, "project_id": "bbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb", "organization_id": "cccccccc-cccc-cccc-cccc-cccccccccccc", "created_at": "2023-01-01T10:00:00Z", "updated_at": "2023-01-01T10:05:00Z" } ``` ``` -------------------------------- ### Get Interlink Dedicated Connection by ID Source: https://github.com/scaleway/terraform-provider-scaleway/blob/main/docs/data-sources/interlink_dedicated_connection.md This example demonstrates how to retrieve a dedicated connection by its unique ID. ```APIDOC ## Get Interlink Dedicated Connection by ID ### Description Retrieves information about a specific Interlink Dedicated Connection using its unique identifier. ### Method GET ### Endpoint `/interlink/v1/dedicated_connections/{connection_id}` ### Parameters #### Path Parameters - **connection_id** (string) - Required - The unique ID of the dedicated connection. #### Query Parameters - **region** (string) - Optional - The region where the dedicated connection is located. Defaults to the provider's region. ### Response #### Success Response (200) - **id** (string) - The ID of the dedicated connection. - **status** (string) - The current status of the dedicated connection. - **tags** (array) - A list of tags associated with the connection. - **pop_id** (string) - The ID of the Point of Presence (PoP) where the connection is established. - **bandwidth_mbps** (integer) - The bandwidth of the connection in Mbps. - **available_link_bandwidths** (array) - A list of supported link bandwidths for this connection. - **demarcation_info** (object) - Information required by the data center for Cross Connect setup. - **customer_access_point** (string) - Customer access point details. - **provider_access_point** (string) - Provider access point details. - **vlan_range** (object) - The VLAN range allocated for self-hosted links. - **start** (integer) - The starting VLAN ID. - **end** (integer) - The ending VLAN ID. - **project_id** (string) - The ID of the project this connection belongs to. - **organization_id** (string) - The ID of the organization this connection belongs to. - **created_at** (string) - The creation date of the connection in RFC 3339 format. - **updated_at** (string) - The last modification date of the connection in RFC 3339 format. ### Response Example ```json { "id": "11111111-1111-1111-1111-111111111111", "status": "available", "tags": ["production", "network"], "pop_id": "aaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa", "bandwidth_mbps": 1000, "available_link_bandwidths": [ {"min_bandwidth_mbps": 100, "max_bandwidth_mbps": 1000}, {"min_bandwidth_mbps": 500, "max_bandwidth_mbps": 1000} ], "demarcation_info": { "customer_access_point": "Rack 1, Unit 5", "provider_access_point": "Patch Panel A, Port 12" }, "vlan_range": { "start": 100, "end": 199 }, "project_id": "bbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb", "organization_id": "cccccccc-cccc-cccc-cccc-cccccccccccc", "created_at": "2023-01-01T10:00:00Z", "updated_at": "2023-01-01T10:05:00Z" } ``` ``` -------------------------------- ### Create an instance server with a reserved IP Source: https://github.com/scaleway/terraform-provider-scaleway/blob/main/docs/resources/instance_server.md This example shows how to create an instance server and assign a pre-reserved IP address to it. ```terraform resource "scaleway_instance_ip" "ip" {} resource "scaleway_instance_server" "web" { type = "DEV1-S" image = "f974feac-abae-4365-b988-8ec7d1cec10d" tags = ["hello", "public"] ip_id = scaleway_instance_ip.ip.id } ``` -------------------------------- ### Get Baremetal Offer by Name Source: https://github.com/scaleway/terraform-provider-scaleway/blob/main/docs/data-sources/baremetal_offer.md This example demonstrates how to retrieve information about a specific baremetal offer by its name. ```APIDOC ## GET /baremetal/offers ### Description Retrieves information about a specific baremetal offer. ### Method GET ### Endpoint /baremetal/offers ### Query Parameters - **zone** (string) - Required - The zone where the offer is available. - **name** (string) - Optional - The name of the offer. Only one of `name` or `offer_id` should be specified. - **offer_id** (string) - Optional - The ID of the offer. Only one of `name` or `offer_id` should be specified. - **include_disabled** (boolean) - Optional - Defaults to `false`. Include disabled offers. - **subscription_period** (string) - Optional - Period of subscription the desired offer. Should be `hourly` or `monthly`. ### Response #### Success Response (200) - **id** (string) - The ID of the offer. - **bandwidth** (object) - Available Bandwidth with the offer. - **commercial_range** (string) - Commercial range of the offer. - **cpu** (object) - A list of cpu specifications. - **disk** (object) - A list of disk specifications. - **memory** (object) - A list of memory specifications. - **stock** (string) - Stock status for this offer. Possible values are: `empty`, `low` or `available`. ### Request Example ```hcl data "scaleway_baremetal_offer" "my_offer" { zone = "fr-par-2" name = "EM-A210R-SATA" } ``` ### Response Example ```json { "id": "fr-par-2/25dcf38b-c90c-4b18-97a2-6956e9d1e113", "bandwidth": { "amount": "1 Gbit/s", "unit": "Gbit/s" }, "commercial_range": "A210", "cpu": [ { "name": "AMD EPYC 7302P", "core_count": 16, "frequency": 3300000000, "thread_count": 32 } ], "disk": [ { "type": "SATA", "capacity": 1000000000000 } ], "memory": [ { "type": "DDR4", "capacity": 67108864000, "frequency": 3200000000, "is_ecc": true } ], "stock": "available" } ``` ``` -------------------------------- ### Full Scaleway Infrastructure Example Source: https://github.com/scaleway/terraform-provider-scaleway/blob/main/docs/index.md Sets up a web server with an additional volume, a public IP, and a security group. Ensure your Scaleway credentials and project ID are configured. ```hcl 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 } ``` -------------------------------- ### Get VPN Gateway by ID Source: https://github.com/scaleway/terraform-provider-scaleway/blob/main/docs/data-sources/s2s_vpn_gateway.md This example demonstrates how to retrieve VPN gateway information by providing its unique ID. ```APIDOC ## GET /vpn/gateways/{vpn_gateway_id} ### Description Retrieves details of a specific S2S VPN gateway using its ID. ### Method GET ### Endpoint /vpn/gateways/{vpn_gateway_id} ### Parameters #### Path Parameters - **vpn_gateway_id** (string) - Required - The unique identifier of the VPN gateway. ### Response #### Success Response (200) - **id** (string) - The ID of the VPN gateway. - **name** (string) - The name of the VPN gateway. - **gateway_type** (string) - The type of the VPN gateway (commercial offer). - **private_network_id** (string) - The ID of the associated Private Network. - **ipam_private_ipv4_id** (string) - The ID of the IPAM private IPv4 address. - **ipam_private_ipv6_id** (string) - The ID of the IPAM private IPv6 address. - **public_config** (object) - Configuration details for the public endpoint. - **address** (string) - The public IP address of the gateway. - **asn** (integer) - The BGP Autonomous System Number. - **status** (string) - The current status of the VPN gateway (e.g., `READY`, `ERROR`). - **zone** (string) - The availability zone where the gateway is deployed. - **tags** (array of strings) - Tags associated with the VPN gateway. - **created_at** (string) - The date and time when the gateway was created. - **updated_at** (string) - The date and time when the gateway was last updated. - **organization_id** (string) - The ID of the organization the gateway belongs to. - **project_id** (string) - The ID of the project the gateway belongs to. ### Response Example ```json { "id": "11111111-1111-1111-1111-111111111111", "name": "my-vpn-gateway", "gateway_type": "VGW_HIGH_PERFORMANCE", "private_network_id": "22222222-2222-2222-2222-222222222222", "ipam_private_ipv4_id": "33333333-3333-3333-3333-333333333333", "ipam_private_ipv6_id": null, "public_config": { "address": "192.0.2.1" }, "asn": 65001, "status": "READY", "zone": "fr-par-1", "tags": ["production", "vpn"], "created_at": "2023-10-27T10:00:00Z", "updated_at": "2023-10-27T10:05:00Z", "organization_id": "aaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa", "project_id": "bbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb" } ``` ``` -------------------------------- ### Get VPN Gateway by Name Source: https://github.com/scaleway/terraform-provider-scaleway/blob/main/docs/data-sources/s2s_vpn_gateway.md This example shows how to retrieve VPN gateway information by specifying its name within a project. ```APIDOC ## GET /vpn/gateways?name={name}&project_id={project_id} ### Description Retrieves details of an S2S VPN gateway by its name within a specific project. ### Method GET ### Endpoint /vpn/gateways ### Parameters #### Query Parameters - **name** (string) - Required - The name of the VPN gateway. - **project_id** (string) - Required - The ID of the project the VPN gateway is associated with. ### Response #### Success Response (200) - **id** (string) - The ID of the VPN gateway. - **name** (string) - The name of the VPN gateway. - **gateway_type** (string) - The type of the VPN gateway (commercial offer). - **private_network_id** (string) - The ID of the associated Private Network. - **ipam_private_ipv4_id** (string) - The ID of the IPAM private IPv4 address. - **ipam_private_ipv6_id** (string) - The ID of the IPAM private IPv6 address. - **public_config** (object) - Configuration details for the public endpoint. - **address** (string) - The public IP address of the gateway. - **asn** (integer) - The BGP Autonomous System Number. - **status** (string) - The current status of the VPN gateway (e.g., `READY`, `ERROR`). - **zone** (string) - The availability zone where the gateway is deployed. - **tags** (array of strings) - Tags associated with the VPN gateway. - **created_at** (string) - The date and time when the gateway was created. - **updated_at** (string) - The date and time when the gateway was last updated. - **organization_id** (string) - The ID of the organization the gateway belongs to. ### Response Example ```json { "id": "44444444-4444-4444-4444-444444444444", "name": "foobar", "gateway_type": "VGW_STANDARD", "private_network_id": "55555555-5555-5555-5555-555555555555", "ipam_private_ipv4_id": "66666666-6666-6666-6666-666666666666", "ipam_private_ipv6_id": null, "public_config": { "address": "198.51.100.10" }, "asn": 65002, "status": "READY", "zone": "fr-sen-1", "tags": [], "created_at": "2023-10-26T09:00:00Z", "updated_at": "2023-10-26T09:02:00Z", "organization_id": "aaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa" } ``` ``` -------------------------------- ### Create an instance server with user data and cloud-init Source: https://github.com/scaleway/terraform-provider-scaleway/blob/main/docs/resources/instance_server.md This example shows how to provide custom user data, including a cloud-init configuration file, to an instance server during creation. ```terraform resource "scaleway_instance_server" "web" { type = "DEV1-S" image = "ubuntu_jammy" user_data = { foo = "bar" cloud-init = file("${path.module}/cloud-init.yml") } } ```