diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 06fa841dca..9d62a043b2 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -66,3 +66,4 @@ jobs: - uses: hashicorp/setup-terraform@v3 - run: go tool tfplugindocs validate - run: go tool tfplugindocs generate + - run: git diff --exit-code docs diff --git a/templates/data-sources/account_project.md.tmpl b/templates/data-sources/account_project.md.tmpl new file mode 100644 index 0000000000..3c8a423a83 --- /dev/null +++ b/templates/data-sources/account_project.md.tmpl @@ -0,0 +1,53 @@ +--- +subcategory: "Account" +page_title: "Scaleway: scaleway_account_project" +--- + +# scaleway_account_project + +The `scaleway_account_project` data source is used to retrieve information about a Scaleway project. + +Refer to the Organizations and Projects [documentation](https://www.scaleway.com/en/docs/organizations-and-projects/) and [API documentation](https://www.scaleway.com/en/developers/api/account/project-api/) for more information. + + +## Retrieve a Scaleway Project + +The following commands allow you to: + +- retrieve a Project by its name +- retrieve a Project by its ID +- retrieve the default project of an Organization + +```hcl +# Get info by name +data scaleway_account_project "by_name" { + name = "myproject" + organization_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" +} +# Get default project +data scaleway_account_project "by_name" { + name = "default" +} +# Get info by ID +data scaleway_account_project "by_id" { + project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" +} +``` + +## Argument Reference + +This section lists the arguments that you can provide to the `scaleway_account_project` data source to filter and retrieve the desired project. Each argument has a specific purpose: + +- `name` - (Optional) The name of the Project. + Only one of the `name` and `project_id` should be specified. + +- `project_id` - (Optional) The unique identifier of the Project. + Only one of the `name` and `project_id` should be specified. + +- `organization_id` - (Optional) The unique identifier of the Organization with which the Project is associated. + + If no default `organization_id` is set, one must be set explicitly in this datasource + +## Attribute reference + +The `scaleway_account_project` data source exports certain attributes once the account information is retrieved. These attributes can be referenced in other parts of your Terraform configuration. The exported attributes come from the `account_project` [resource](../resources/account_project.md). diff --git a/templates/data-sources/account_projects.md.tmpl b/templates/data-sources/account_projects.md.tmpl new file mode 100644 index 0000000000..7a57658f00 --- /dev/null +++ b/templates/data-sources/account_projects.md.tmpl @@ -0,0 +1,57 @@ +--- +subcategory: "Account" +page_title: "Scaleway: scaleway_account_projects" +--- + +# scaleway_account_projects + +The `scaleway_account_projects` data source is used to list all Scaleway projects in an Organization. + +Refer to the Organizations and Projects [documentation](https://www.scaleway.com/en/docs/organizations-and-projects/) and [API documentation](https://www.scaleway.com/en/developers/api/account/project-api/) for more information. + + +## Retrieve a Scaleway Projects + +The following commands allow you to: + +- retrieve all Projects in an Organization + +```hcl +# Get all Projects in an Organization +data scaleway_account_projects "all" { + organization_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" +} +``` + +## Example Usage + +### Deploy an SSH key in all your organization's projects + +```hcl +data scaleway_account_projects "all" {} + +resource "scaleway_account_ssh_key" "main" { + name = "main" + public_key = local.public_key + count = length(data.scaleway_account_projects.all.projects) + project_id = data.scaleway_account_projects.all.projects[count.index].id +} +``` + +## Argument Reference + +- `organization_id` - (Optional) The unique identifier of the Organization with which the Projects are associated. + If no default `organization_id` is set, one must be set explicitly in this datasource + + +## Attribute reference + +The `scaleway_account_projects` data source exports the following attributes: + +- `projects` - (Computed) A list of projects. Each project has the following attributes: + - `id` - (Computed) The unique identifier of the project. + - `name` - (Computed) The name of the project. + - `organization_id` - (Computed) The unique identifier of the organization with which the project is associated. + - `created_at` - (Computed) The date and time when the project was created. + - `updated_at` - (Computed) The date and time when the project was updated. + - `description` - (Computed) The description of the project. diff --git a/templates/data-sources/account_ssh_key.md.tmpl b/templates/data-sources/account_ssh_key.md.tmpl new file mode 100644 index 0000000000..60fdd4f8a8 --- /dev/null +++ b/templates/data-sources/account_ssh_key.md.tmpl @@ -0,0 +1,51 @@ +--- +subcategory: "Account" +page_title: "Scaleway: scaleway_account_ssh_key" +--- + +# scaleway_account_ssh_key + +The `scaleway_account_ssh_key` data source is used to retrieve information about a the SSH key of a Scaleway account. + +Refer to the Organizations and Projects [documentation](https://www.scaleway.com/en/docs/organizations-and-projects/how-to/create-ssh-key/) and [API documentation](https://www.scaleway.com/en/developers/api/iam/#path-ssh-keys) for more information. + + +## Retrieve the SSH key of a Scaleway account + +The following commands allow you to: + +- retrieve an SSH key by its name +- retrieve an SSH key by its ID + +```hcl +# Get info by SSH key name +data "scaleway_account_ssh_key" "my_key" { + name = "my-key-name" +} + +# Get info by SSH key id +data "scaleway_account_ssh_key" "my_key" { + ssh_key_id = "11111111-1111-1111-1111-111111111111" +} +``` + +## Argument Reference + +This section lists the arguments that you can provide to the `scaleway_account_ssh_key` data source to filter and retrieve the desired SSH key. Each argument has a specific purpose: + +- `name` - The name of the SSH key. +- `ssh_key_id` - The unique identifier of the SSH key. + + -> **Note** You must specify at least one: `name` and/or `ssh_key_id`. + +- `project_id` - (Defaults to [provider](../index.md#project_id) `project_id`) The unique identifier of the project with which the SSH key is associated. + +## Attributes Reference + +The `scaleway_account_ssh_key` data source exports certain attributes once the SSH key information is retrieved. These attributes can be referenced in other parts of your Terraform configuration. + +In addition to all above arguments, the following attributes are exported: + +- `id` - The unique identifier of the SSH public key. +- `public_key` - The string of the SSH public key. +- `organization_id` - The unique identifier of the Organization with which the SSH key is associated. diff --git a/templates/data-sources/availability_zones.md.tmpl b/templates/data-sources/availability_zones.md.tmpl new file mode 100644 index 0000000000..89eff17f86 --- /dev/null +++ b/templates/data-sources/availability_zones.md.tmpl @@ -0,0 +1,39 @@ +--- +subcategory: "Account" +page_title: "Scaleway: scaleway_availability_zones" +--- + +# scaleway_availability_zones + +The `scaleway_availability_zones` data source is used to retrieve information about the available zones based on its Region. + +For technical and legal reasons, some products are split by Region or by Availability Zones. When using such product, +you can choose the location that better fits your need (country, latency, etc.). + +Refer to the Account [documentation](https://www.scaleway.com/en/docs/console/account/reference-content/products-availability/) for more information. + +## Retrieve the Availability Zones of a Region + +The following command allow you to retrieve a the AZs of a Region. + +```hcl +# Get info by Region key +data "scaleway_availability_zones" "main" { + region = "nl-ams" +} +``` + +## Argument Reference + +This section lists the arguments that you can provide to the `scaleway_availability_zones` data source to filter and retrieve the desired AZs: + +- `region` - Region is represented as a Geographical area, such as France. Defaults to `fr-par`. + +## Attributes Reference + +The `scaleway_availability_zones` data source exports certain attributes once the Availability Zones information is retrieved. These attributes can be referenced in other parts of your Terraform configuration. + +In addition to all above arguments, the following attributes are exported: + +- `id` - The unique identifier of the Region +- `zones` - The list of availability zones in each Region diff --git a/templates/data-sources/baremetal_offer.md.tmpl b/templates/data-sources/baremetal_offer.md.tmpl new file mode 100644 index 0000000000..bbd099f5bc --- /dev/null +++ b/templates/data-sources/baremetal_offer.md.tmpl @@ -0,0 +1,82 @@ +--- +subcategory: "Elastic Metal" +page_title: "Scaleway: scaleway_baremetal_offer" +--- + +# scaleway_baremetal_offer + +Gets information about a baremetal offer. For more information, see the [API documentation](https://developers.scaleway.com/en/products/baremetal/api). + +## Example Usage + +```hcl +# Get info by offer name +data "scaleway_baremetal_offer" "my_offer" { + zone = "fr-par-2" + name = "EM-A210R-SATA" +} + +# Get info by offer id +data "scaleway_baremetal_offer" "my_offer" { + zone = "fr-par-2" + offer_id = "25dcf38b-c90c-4b18-97a2-6956e9d1e113" +} +``` + +## Argument Reference + +- `name` - (Optional) The offer name. Only one of `name` and `offer_id` should be specified. + +- `subscription_period` - (Optional) Period of subscription the desired offer. Should be `hourly` or `monthly`. + +- `offer_id` - (Optional) The offer id. Only one of `name` and `offer_id` should be specified. + +- `allow_disabled` - (Optional, default `false`) Include disabled offers. + +- `zone` - (Defaults to [provider](../index.md#zone) `zone`) The [zone](../guides/regions_and_zones.md#zones) in which the offer should be created. + +## Attributes Reference + +In addition to all above arguments, the following attributes are exported: + +- `id` - The ID of the offer. + +~> **Important:** Baremetal offers' IDs are [zoned](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{zone}/{id}`, e.g. `fr-par-1/11111111-1111-1111-1111-111111111111` + +- `bandwidth` - Available Bandwidth with the offer. + +- `commercial_range` - Commercial range of the offer. + +- `cpu` - A list of cpu specifications. (Structure is documented below.) + +- `disk` - A list of disk specifications. (Structure is documented below.) + +- `memory` - A list of memory specifications. (Structure is documented below.) + +- `stock` - Stock status for this offer. Possible values are: `empty`, `low` or `available`. + +The `cpu` block supports: + +- `name` - Name of the CPU. + +- `core_count`- Number of core on this CPU. + +- `frequency`- Frequency of the CPU in MHz. + +- `thread_count`- Number of thread on this CPU. + +The `disk` block supports: + +- `type` - Type of disk. + +- `capacity`- Capacity of the disk in GB. + +The `memory` block supports: + +- `type` - Type of memory. + +- `capacity`- Capacity of the memory in GB. + +- `frequency` - Frequency of the memory in MHz. + +- `is_ecc`- True if error-correcting code is available on this memory. diff --git a/templates/data-sources/baremetal_option.md.tmpl b/templates/data-sources/baremetal_option.md.tmpl new file mode 100644 index 0000000000..dcaac20519 --- /dev/null +++ b/templates/data-sources/baremetal_option.md.tmpl @@ -0,0 +1,40 @@ +--- +subcategory: "Elastic Metal" +page_title: "Scaleway: scaleway_baremetal_option" +--- + +# scaleway_baremetal_option + +Gets information about a baremetal option. +For more information, see the [API documentation](https://developers.scaleway.com/en/products/baremetal/api). + +## Example Usage + +```hcl +# Get info by option name +data "scaleway_baremetal_option" "by_name" { + name = "Remote Access" +} + +# Get info by option id +data "scaleway_baremetal_option" "by_id" { + option_id = "931df052-d713-4674-8b58-96a63244c8e2" +} +``` + +## Argument Reference + +- `name` - (Optional) The option name. Only one of `name` and `option_id` should be specified. +- `option_id` - (Optional) The option id. Only one of `name` and `option_id` should be specified. +- `zone` - (Defaults to [provider](../index.md#zone) `zone`) The [zone](../guides/regions_and_zones.md#zones) in which the option exists. + +## Attributes Reference + +In addition to all above arguments, the following attributes are exported: + +- `id` - The ID of the option. + +~> **Important:** Baremetal options' IDs are [zoned](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{zone}/{id}`, e.g. `fr-par-1/11111111-1111-1111-1111-111111111111` + +- `name` - The name of the option. +- `manageable` - Is false if the option could not be added or removed. diff --git a/templates/data-sources/baremetal_os.md.tmpl b/templates/data-sources/baremetal_os.md.tmpl new file mode 100644 index 0000000000..9cffb3f7a5 --- /dev/null +++ b/templates/data-sources/baremetal_os.md.tmpl @@ -0,0 +1,41 @@ +--- +subcategory: "Elastic Metal" +page_title: "Scaleway: scaleway_baremetal_os" +--- + +# scaleway_baremetal_os + +Gets information about a baremetal operating system. +For more information, see the [API documentation](https://www.scaleway.com/en/developers/api/elastic-metal/#path-os-list-available-oses). + +You can also use the [scaleway-cli](https://github.com/scaleway/scaleway-cli) with `scw baremetal os list` to list all available operating systems. + +## Example Usage + +```hcl +# Get info by os name and version +data "scaleway_baremetal_os" "by_name" { + name = "Ubuntu" + version = "20.04 LTS (Focal Fossa)" +} + +# Get info by os id +data "scaleway_baremetal_os" "by_id" { + os_id = "03b7f4ba-a6a1-4305-984e-b54fafbf1681" +} +``` + +## Argument Reference + +- `name` - (Optional) The os name. Only one of `name` and `os_id` should be specified. +- `version` - (Optional) The os version. +- `os_id` - (Optional) The operating system id. Only one of `name` and `os_id` should be specified. +- `zone` - (Defaults to [provider](../index.md#zone) `zone`) The [zone](../guides/regions_and_zones.md#zones) in which the os exists. + +## Attributes Reference + +In addition to all above arguments, the following attributes are exported: + +- `id` - The resource's ID + +~> **Important:** Baremetal operating systems' IDs are [zoned](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{zone}/{id}`, e.g. `fr-par-1/11111111-1111-1111-1111-111111111111` diff --git a/templates/data-sources/baremetal_partition_schema.md.tmpl b/templates/data-sources/baremetal_partition_schema.md.tmpl new file mode 100644 index 0000000000..29697f632a --- /dev/null +++ b/templates/data-sources/baremetal_partition_schema.md.tmpl @@ -0,0 +1,85 @@ +--- +subcategory: "Elastic Metal" +page_title: "Scaleway: scaleway_baremetal_partition_schema" +--- + +# scaleway_baremetal_partition_schema + +The scaleway_baremetal_partition_schema data source allows you to retrieve a ready-to-use partitioning schema for a BareMetal server. This schema can be used for custom installations with optional swap and extra partitions. + +This data source simplifies the process of generating valid partitioning configurations, especially useful when dealing with OS and offer compatibility requirements. + +## Partitioning Details + +The partitioning schema generated by the `scaleway_baremetal_partition_schema` data source includes a root (`/`) partition that is **20GB** in size by default. + +If additional storage is required, you can enable the `extra_partition` option to mount extra space on a custom path (e.g., `/data`). + + +## Example Usage + +```hcl +data "scaleway_baremetal_partition_schema" "default" { + offer_id = "11111111-1111-1111-1111-111111111111" + os_id = "22222222-2222-2222-2222-222222222222" + swap = true + extra_partition = true + ext_4_mountpoint = "/data" +} +``` + +```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] +} +``` + +## Argument Reference + +- `offer_id` (Required) The UUID of the BareMetal offer. + +- `os_id` (Required) The UUID of the OS image. + +- `swap` (Optional, Default: true) Whether to include a swap partition. + +- `extra_partition` (Optional, Default: true) Whether to add an extra ext4 data partition. + +- `ext_4_mountpoint` (Optional, Default: "/data") The mount point for the extra partition. Must be an absolute path using alphanumeric characters and underscores. + +## Attributes Reference + +In addition to all above arguments, the following attributes are exported: + +- `id` — A composite identifier derived from offer_id and os_id. + +- `json_partition` — A validated partitioning schema in JSON format that can be directly used for BareMetal server deployment. diff --git a/templates/data-sources/baremetal_server.md.tmpl b/templates/data-sources/baremetal_server.md.tmpl new file mode 100644 index 0000000000..9d7d8d64a0 --- /dev/null +++ b/templates/data-sources/baremetal_server.md.tmpl @@ -0,0 +1,40 @@ +--- +subcategory: "Elastic Metal" +page_title: "Scaleway: scaleway_baremetal_server" +--- + +# scaleway_baremetal_server + +Gets information about a baremetal server. +For more information, see the [API documentation](https://developers.scaleway.com/en/products/baremetal/api). + +## Example Usage + +```hcl +# Get info by server name +data "scaleway_baremetal_server" "by_name" { + name = "foobar" + zone = "fr-par-2" +} + +# Get info by server id +data "scaleway_baremetal_server" "by_id" { + server_id = "11111111-1111-1111-1111-111111111111" +} +``` + +## Argument Reference + +- `name` - (Optional) The server name. Only one of `name` and `server_id` should be specified. +- `zone` - (Defaults to [provider](../index.md#zone) `zone`) The [zone](../guides/regions_and_zones.md#zones) in which the server exists. +- `project_id` - (Optional) The ID of the project the baremetal server is associated with. + +## Attributes Reference + +In addition to all above arguments, the following attributes are exported: + +- `id` - The ID of the server. + +The `scaleway_baremetal_server` data source exports certain attributes once the baremetal server information is retrieved. These attributes can be referenced in other parts of your Terraform configuration. The exported attributes are those that come from the `scaleway_baremetal_server` [resource](../resources/baremetal_server.md) + +~> **Important:** Baremetal servers' IDs are [zoned](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{zone}/{id}`, e.g. `fr-par-1/11111111-1111-1111-1111-111111111111` diff --git a/templates/data-sources/billing_consumptions.md.tmpl b/templates/data-sources/billing_consumptions.md.tmpl new file mode 100644 index 0000000000..a77bd124f7 --- /dev/null +++ b/templates/data-sources/billing_consumptions.md.tmpl @@ -0,0 +1,36 @@ +--- +subcategory: "Billing" +page_title: "Scaleway: scaleway_billing_consumptions" +--- + +# scaleway_billing_consumptions + +Gets information about your Consumptions. + +## Example Usage + +```hcl +# Find your detailed monthly consumption list +data "scaleway_billing_consumptions" "my-consumption" { + organization_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" +} +``` + +## Argument Reference + +- `organization_id` - (Defaults to [provider](../index.md#organization_d) `organization_id`) The ID of the organization the consumption list is associated with. +- `project_id` - (Defaults to [provider](../index.md#project_id) `project_id`) The ID of the project the consumption list is associated with. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +- `consumptions` - List of found consumptions + - `value` - The monetary value of the consumption. + - `product_name` - The product name. + - `category_name` - The name of the consumption category. + - `sku` - The unique identifier of the product. + - `unit` - The unit of consumed quantity. + - `billed_quantity` - The consumed quantity. + - `project_id` - The project ID of the consumption. +- `updated_at` - The last consumption update date. diff --git a/templates/data-sources/billing_invoices.md.tmpl b/templates/data-sources/billing_invoices.md.tmpl new file mode 100644 index 0000000000..fe92ec809c --- /dev/null +++ b/templates/data-sources/billing_invoices.md.tmpl @@ -0,0 +1,54 @@ +--- +subcategory: "Billing" +page_title: "Scaleway: scaleway_billing_invoices" +--- + +# scaleway_billing_invoices + +Gets information about your Scaleway invoices. + +## Example Usage + +```hcl +# List invoices starting after a certain date +data "scaleway_billing_invoices" "my-invoices" { + started_after = "2023-10-01T00:00:00Z" +} + +# List invoices by type +data "scaleway_billing_invoices" "my-invoices" { + invoice_type = "periodic" +} +``` + +## Argument Reference + +- `started_after` - (Optional) Invoices with a start date that are greater or equal to `started_after` are listed (RFC 3339 format). + +- `started_before` - (Optional) Invoices with a start date that precedes `started_before` are listed (RFC 3339 format). + +- `invoice_type` - (Optional) Invoices with the given type are listed. Valid values are `periodic` and `purchase`. + +- `organization_id` - (Defaults to [provider](../index.md#organization_d) `organization_id`) The ID of the organization the invoice list is associated with. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +- `invoices` - List of found invoices + - `id` - The associated invoice ID. + - `organization_name` - The organization name. + - `start_date` - The start date of the billing period (RFC 3339 format). + - `stop_date` - The end date of the billing period (RFC 3339 format). + - `billing_period` - The billing period of the invoice in the YYYY-MM format. + - `issued_date` - The date when the invoice was sent to the customer (RFC 3339 format). + - `due_date` - The payment time limit, set according to the Organization's payment conditions (RFC 3339 format). + - `total_untaxed` - The total amount, untaxed. + - `total_taxed` - The total amount, taxed. + - `total_tax` - The total tax amount of the invoice. + - `total_discount` - The total discount amount of the invoice. + - `total_undiscount` - The total amount of the invoice before applying the discount. + - `invoice_type` - The type of invoice. + - `state` - The state of the invoice. + - `number` - The invoice number. + - `seller_name` - The name of the seller (Scaleway). diff --git a/templates/data-sources/block_snapshot.md.tmpl b/templates/data-sources/block_snapshot.md.tmpl new file mode 100644 index 0000000000..de09e8fe83 --- /dev/null +++ b/templates/data-sources/block_snapshot.md.tmpl @@ -0,0 +1,50 @@ +--- +subcategory: "Block" +page_title: "Scaleway: scaleway_block_snapshot" +--- + +# scaleway_block_snapshot + +The `scaleway_block_snapshot` data source is used to retrieve information about a Block Storage volume snapshot. + +Refer to the Block Storage [product documentation](https://www.scaleway.com/en/docs/block-storage/) and [API documentation](https://www.scaleway.com/en/developers/api/block/) for more information. + +## Retrieve a volume's snapshot + +The following commands allow you to: + +- retrieve a snapshot specified by its name +- retrieve a snapshot specified by its name and the ID of the Block Storage volume it is associated with +- retrieve a snapshot specified by its ID + +```terraform +// Get info by snapshot name +data "scaleway_block_snapshot" "my_snapshot" { + name = "my-name" +} + +// Get info by snapshot name and volume id +data "scaleway_block_snapshot" "my_snapshot" { + name = "my-name" + volume_id = "11111111-1111-1111-1111-111111111111" +} + +// Get info by snapshot ID +data "scaleway_block_snapshot" "my_snapshot" { + snapshot_id = "11111111-1111-1111-1111-111111111111" +} +``` + +## Argument Reference + +This section lists the arguments that you can provide to the `scaleway_block_snapshot` data source to filter and retrieve the desired snapshot. Each argument has a specific purpose: + +- `snapshot_id` - (Optional) The unique identifier of the snapshot. Only one of `name` and `snapshot_id` should be specified. +- `name` - (Optional) The name of the snapshot. Only one of name or snapshot_id should be specified. +- `volume_id` - (Optional) The unique identifier of the volume from which the snapshot was created. +- `zone` - (Defaults to the zone specified in the [provider configuration](../index.md#zone)) The [zone](../guides/regions_and_zones.md#zones) in which the snapshot exists. +- `project_id` - (Optional) The unique identifier of the Project to which the snapshot is associated. + +## Attributes Reference + +The `scaleway_block_snapshot` data source exports certain attributes once the snapshot information is retrieved. These attributes can be referenced in other parts of your Terraform configuration. The exported attributes are those that come from the `scaleway_block_snapshot` [resource](../resources/block_snapshot.md) diff --git a/templates/data-sources/block_volume.md.tmpl b/templates/data-sources/block_volume.md.tmpl new file mode 100644 index 0000000000..5798b181ea --- /dev/null +++ b/templates/data-sources/block_volume.md.tmpl @@ -0,0 +1,42 @@ +--- +subcategory: "Block" +page_title: "Scaleway: scaleway_block_volume" +--- + +# scaleway_block_volume + +The `scaleway_block_volume` data source is used to retrieve information about a Block Storage volume. +Refer to the Block Storage [product documentation](https://www.scaleway.com/en/docs/block-storage/) and [API documentation](https://www.scaleway.com/en/developers/api/block/) for more information. + +## Retrieve a Block Storage volume + +The following commands allow you to: + +- retrieve a Block Storage volume specified by its name +- retrieve a Block Storage volume specified by its ID + + +```terraform +// Get info by volume name +data "scaleway_block_volume" "my_volume" { + name = "my-name" +} + +// Get info by volume ID +data "scaleway_block_volume" "my_volume" { + volume_id = "11111111-1111-1111-1111-111111111111" +} +``` + +## Argument Reference + +This section lists the arguments that you can provide to the `scaleway_block_volume` data source to filter and retrieve the desired volume. + +- `volume_id` - (Optional) The unique identifier of the volume. Only one of `name` and `volume_id` should be specified. +- `name` - (Optional) The name of the volume. Only one of `name` and `volume_id` should be specified. +- `zone` - (Defaults to the zone specified in the [provider configuration](../index.md#zone)). The [zone](../guides/regions_and_zones.md#zones) in which the volume exists. +- `project_id` - (Optional) The unique identifier of the Project to which the volume is associated. + +## Attributes Reference + +The `scaleway_block_volume` data source exports certain attributes once the volume information is retrieved. These attributes can be referenced in other parts of your Terraform configuration. The exported attributes are those that come from the `scaleway_block_volume` [resource](../resources/block_volume.md). diff --git a/templates/data-sources/cockpit.md.tmpl b/templates/data-sources/cockpit.md.tmpl new file mode 100644 index 0000000000..51cd02b843 --- /dev/null +++ b/templates/data-sources/cockpit.md.tmpl @@ -0,0 +1,55 @@ +--- +subcategory: "Cockpit" +page_title: "Scaleway: scaleway_cockpit" +--- +# scaleway_cockpit + + +~> **Important:** The data source `scaleway_cockpit` has been deprecated and will no longer be supported. Instead, use resource `scaleway_cockpit`. + +-> **Note:** +As of April 2024, Cockpit has introduced [regionalization](https://www.scaleway.com/en/docs/observability/cockpit/concepts/#region) to offer more flexibility and resilience. +If you have created customized dashboards with data for your Scaleway resources before April 2024, you will need to update your queries in Grafana, with the new regionalized [data sources](../resources/cockpit_source.md). + +The `scaleway_cockpit` data source is used to retrieve information about a Scaleway Cockpit associated with a given Project. This can be the default Project or a specific Project identified by its ID. + +Refer to Cockpit's [product documentation](https://www.scaleway.com/en/docs/observability/cockpit/concepts/) and [API documentation](https://www.scaleway.com/en/developers/api/cockpit/regional-api) for more information. + +## Retrieve a Cockpit + +The following commands allow you to: + +- get information on the Cockpit associated with your Scaleway default Project +- get information on the Cockpit associated with a specific Scaleway Project + +```hcl +// Get the default Project's Cockpit +data "scaleway_cockpit" "main" {} +``` + +```hcl +// Get a specific Project's Cockpit +data "scaleway_cockpit" "main" { + project_id = "11111111-1111-1111-1111-111111111111" +} +``` + +## Argument Reference + +This section lists the arguments that you can provide to the `scaleway_cockpit` data source to filter and retrieve the desired Cockpit. + +- `project_id` - Specifies the ID of the Scaleway Project that the Cockpit is associated with. If not specified, it defaults to the Project ID specified in the [provider configuration](../index.md#project_id). + +- `plan` - (Optional) Specifies the name or ID of the pricing plan to use. + + +## Attributes Reference + +The `scaleway_cockpit` data source exports certain attributes once the Cockpit information is retrieved. These attributes can be referenced in other parts of your Terraform configuration. + +- `plan_id` - (Deprecated) ID of the current pricing plan +- `endpoints` - (Deprecated) A list of [endpoints](https://www.scaleway.com/en/docs/observability/cockpit/concepts/#endpoints) related to Cockpit, each with specific URLs: + - `metrics_url` - (Deprecated) URL for [metrics](https://www.scaleway.com/en/docs/observability/cockpit/concepts/#metric) to retrieve in the [Data sources tab](https://console.scaleway.com/cockpit/dataSource) of the Scaleway console. + - `logs_url` - (Deprecated) URL for [logs](https://www.scaleway.com/en/docs/observability/cockpit/concepts/#logs) to retrieve in the [Data sources tab](https://console.scaleway.com/cockpit/dataSource) of the Scaleway console. + - `alertmanager_url` - (Deprecated) URL for the [Alert manager](https://www.scaleway.com/en/docs/observability/cockpit/concepts/#alert-manager). + - `grafana_url` - (Deprecated) URL for Grafana. diff --git a/templates/data-sources/cockpit_source.md.tmpl b/templates/data-sources/cockpit_source.md.tmpl new file mode 100644 index 0000000000..7a9b76a159 --- /dev/null +++ b/templates/data-sources/cockpit_source.md.tmpl @@ -0,0 +1,79 @@ +--- +subcategory: "Cockpit" +page_title: "Scaleway: scaleway_cockpit_source" +--- + +# Data Source: scaleway_cockpit_source + +The `scaleway_cockpit_source` data source allows you to retrieve information about a specific [data source](https://www.scaleway.com/en/docs/observability/cockpit/concepts/#data-sources) in Scaleway's Cockpit. + +Refer to Cockpit's [product documentation](https://www.scaleway.com/en/docs/observability/cockpit/concepts/) and [API documentation](https://www.scaleway.com/en/developers/api/cockpit/regional-api) for more information. + +## Example Usage + +### Retrieve a specific data source by ID + +The following example retrieves a Cockpit data source by its unique ID. + +```terraform +data "scaleway_cockpit_source" "example" { + id = "fr-par/11111111-1111-1111-1111-111111111111" +} +``` + +### Retrieve a data source by filters + +You can also retrieve a data source by specifying filtering criteria such as `name`, `type`, and `origin`. + +```terraform +data "scaleway_cockpit_source" "filtered" { + project_id = "11111111-1111-1111-1111-111111111111" + region = "fr-par" + name = "my-data-source" +} +``` + +## Argument Reference + +This section lists the arguments that are supported: + +- `id` - (Optional) The unique identifier of the Cockpit data source in the `{region}/{id}` format. If specified, other filters are ignored. + +- `region` - (Optional) The [region](../guides/regions_and_zones.md#regions) where the data source is located. Defaults to the region specified in the [provider configuration](../index.md#region). + +- `project_id` - (Required unless `id` is specified) The ID of the Project the data source is associated with. Defaults to the Project ID specified in the [provider configuration](../index.md#project_id). + +- `name` - (Optional) The name of the data source. + +- `type` - (Optional) The [type](https://www.scaleway.com/en/docs/observability/cockpit/concepts/#data-types) of data source. Possible values are: `metrics`, `logs`, or `traces`. + +- `origin` - (Optional) The origin of the data source. Possible values are: + - `scaleway` - Data source managed by Scaleway. + - `external` - Data source created by the user. + - `custom` - User-defined custom data source. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +- `id` - The unique identifier of the data source in the `{region}/{id}` format. + +- `url` - The URL of the Cockpit data source. + +- `created_at` - The date and time the data source was created (in RFC 3339 format). + +- `updated_at` - The date and time the data source was last updated (in RFC 3339 format). + +- `origin` - The origin of the data source. + +- `synchronized_with_grafana` - Indicates whether the data source is synchronized with Grafana. + +- `retention_days` - The number of days the data is retained in the data source. + +## Import + +You can import a Cockpit data source using its unique ID in the `{region}/{id}` format. + +```bash +terraform import scaleway_cockpit_source.example fr-par/11111111-1111-1111-1111-111111111111 +``` diff --git a/templates/data-sources/config.md.tmpl b/templates/data-sources/config.md.tmpl new file mode 100644 index 0000000000..8dfbf60fc1 --- /dev/null +++ b/templates/data-sources/config.md.tmpl @@ -0,0 +1,15 @@ +--- +subcategory: "Config" +page_title: "Scaleway: scaleway_config" +--- + +# scaleway_config + +Gets information about the current configuration that Scaleway provider is using. + +## Example Usage + +```hcl +# Get configuration information +data "scaleway_config" "main" {} +``` diff --git a/templates/data-sources/container.md.tmpl b/templates/data-sources/container.md.tmpl new file mode 100644 index 0000000000..328dd1a8aa --- /dev/null +++ b/templates/data-sources/container.md.tmpl @@ -0,0 +1,113 @@ +--- +subcategory: "Containers" +page_title: "Scaleway: scaleway_container" +--- +# scaleway_container + +The `scaleway_container` data source is used to retrieve information about a Serverless Container. + +Refer to the Serverless Containers [product documentation](https://www.scaleway.com/en/docs/serverless/containers/) and [API documentation](https://www.scaleway.com/en/developers/api/serverless-containers/) for more information. + +For more information on the limitations of Serverless Containers, refer to the [dedicated documentation](https://www.scaleway.com/en/docs/serverless-containers/reference-content/containers-limitations/). + +## Retrieve a Serverless Container + +The following commands allow you to: + +- retrieve a container by its name +- retrieve a container by its ID + +```hcl +resource "scaleway_container_namespace" "main" { +} + +resource "scaleway_container" "main" { + name = "test-container-data" + namespace_id = scaleway_container_namespace.main.id +} + +// Get info by container name +data "scaleway_container" "by_name" { + namespace_id = scaleway_container_namespace.main.id + name = scaleway_container.main.name +} + +// Get info by container ID +data "scaleway_container" "by_id" { + namespace_id = scaleway_container_namespace.main.id + container_id = scaleway_container.main.id +} +``` + +## Arguments reference + +This section lists the arguments that you can provide to the `scaleway_container` data source to filter and retrieve the desired namespace. Each argument has a specific purpose: + +- `name` - (Required) The unique name of the container. + +- `namespace_id` - (Required) The container namespace ID of the container. + +- `project_id` - (Optional) The unique identifier of the project with which the container is associated. + +~> **Important** Updating the `name` argument will recreate the container. + +## Attributes Reference + +The `scaleway_container` data source exports certain attributes once the container information is retrieved. These attributes can be referenced in other parts of your Terraform configuration. + +In addition to all arguments above, the following attributes are exported: + +- `id` - The ID of the container + +~> **Important:** Containers' IDs are [regional](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{region}/{id}`, e.g. `fr-par/11111111-1111-1111-1111-111111111111` + +- `description` The description of the container. + +- `environment_variables` - The [environment](https://www.scaleway.com/en/docs/serverless-containers/concepts/#environment-variables) variables of the container. + +- `min_scale` - The minimum number of container instances running continuously. + +- `max_scale` - The maximum number of instances the container can scale to. + +- `memory_limit` - The memory resources in MB to allocate to each container. + +- `cpu_limit` - The amount of vCPU computing resources to allocate to each container. + +- `timeout` - The maximum amount of time your container can spend processing a request before being stopped. + +- `privacy` - The privacy type define the way to authenticate to your container. Refer to the [dedicated documentation](https://www.scaleway.com/en/developers/api/serverless-containers/#path-containers-update-an-existing-container) for more information. + +- `registry_image` - The registry image address (e.g. `rg.fr-par.scw.cloud/$NAMESPACE/$IMAGE`). + +- `registry_sha256` - The sha256 of your source registry image, changing it will re-apply the deployment. Can be any string. + +- `max_concurrency` - The maximum number of simultaneous requests your container can handle at the same time. + +- `domain_name` - The container domain name. + +- `protocol` - The communication [protocol](https://www.scaleway.com/en/developers/api/serverless-containers/#path-containers-update-an-existing-container) `http1` or `h2c`. Defaults to `http1`. + +- `port` - The port to expose the container. + +- `deploy` - Boolean indicating whether the container is on a production environment. + +- `sandbox` - Execution environment of the container. + +- `health_check` - Health check configuration block of the container. + - `http` - HTTP health check configuration. + - `path` - Path to use for the HTTP health check. + - `failure_threshold` - Number of consecutive health check failures before considering the container unhealthy. + - `interval`- Period between health checks (in seconds). +- `sandbox` - (Optional) Execution environment of the container. +- `scaling_option` - Configuration block used to decide when to scale up or down. Possible values: + - `concurrent_requests_threshold` - Scale depending on the number of concurrent requests being processed per container instance. + - `cpu_usage_threshold` - Scale depending on the CPU usage of a container instance. + - `memory_usage_threshold`- Scale depending on the memory usage of a container instance. + +- `status` - The container status. + +- `cron_status` - The cron status of the container. + +- `error_message` - The error message of the container. + +- `region` - (Defaults to [provider](../index.md#region) `region`) The [region](../guides/regions_and_zones.md#regions) in which the container was created. diff --git a/templates/data-sources/container_namespace.md.tmpl b/templates/data-sources/container_namespace.md.tmpl new file mode 100644 index 0000000000..5569e4ae87 --- /dev/null +++ b/templates/data-sources/container_namespace.md.tmpl @@ -0,0 +1,57 @@ +--- +subcategory: "Containers" +page_title: "Scaleway: scaleway_container_namespace" +--- + +# scaleway_container_namespace + +The `scaleway_container_namespace` data source is used to retrieve information about a Serverless Containers namespace. + +Refer to the Serverless Containers [product documentation](https://www.scaleway.com/en/docs/serverless/containers/) and [API documentation](https://www.scaleway.com/en/developers/api/serverless-containers/) for more information. + +## Retrieve a Serverless Containers namespace + +The following commands allow you to: + +- retrieve a namespace by its name +- retrieve a namespace by its ID + +```hcl +// Get info by namespace name +data "scaleway_container_namespace" "by_name" { + name = "my-namespace-name" +} + +// Get info by namespace ID +data "scaleway_container_namespace" "by_id" { + namespace_id = "11111111-1111-1111-1111-111111111111" +} +``` + +## Argument Reference + +This section lists the arguments that you can provide to the `scaleway_container_namespace` data source to filter and retrieve the desired namespace. Each argument has a specific purpose: + +- `name` - (Optional) The name of the namespace. Only one of `name` and `namespace_id` should be specified. + +- `namespace_id` - (Optional) The unique identifier of the namespace. Only one of `name` and `namespace_id` should be specified. + +- `region` - (Defaults to the region specified in the [provider configuration](../index.md#region) `region`) The [region](../guides/regions_and_zones.md#regions) in which the namespace exists. + +- `project_id` - (Defaults to [provider](../index.md#project_id) `project_id`) The unique identifier of the project with which the namespace is associated. + +## Attributes Reference + +The `scaleway_container_namespace` data source exports certain attributes once the namespace information is retrieved. These attributes can be referenced in other parts of your Terraform configuration. + +In addition to the arguments above, the following attributes are exported: + +- `id` - The unique identifier of the container namespace. + +~> **Important:** Serverless Containers namespace IDs are [regional](../guides/regions_and_zones.md#resource-ids), which means they are expressed in the form `{region}/{id}`, e.g. `fr-par/11111111-1111-1111-1111-111111111111` + +- `organization_id` - The unique identifier of the organization with which the namespace is associated. +- `description` - The description of the namespace. +- `environment_variables` - The environment variables of the namespace. +- `registry_endpoint` - The registry endpoint of the namespace. +- `registry_namespace_id` - The unique identifier of the registry namespace of the Serverless Containers namespace. diff --git a/templates/data-sources/domain_record.md.tmpl b/templates/data-sources/domain_record.md.tmpl new file mode 100644 index 0000000000..76c5b9d67a --- /dev/null +++ b/templates/data-sources/domain_record.md.tmpl @@ -0,0 +1,65 @@ +--- +subcategory: "Domains and DNS" +page_title: "Scaleway: scaleway_domain_record" +--- + +# scaleway_domain_record + +The `scaleway_domain_record` data source is used to get information about an existing domain record. + +Refer to the Domains and DNS [product documentation](https://www.scaleway.com/en/docs/network/domains-and-dns/) and [API documentation](https://www.scaleway.com/en/developers/api/domains-and-dns/) for more information. + + +## Query domain records + +The following commands allow you to: + +- query a domain record specified by the DNS zone (`domain.tld`), the record name (`www`), the record type (`A`), and the record content (`1.2.3.4`). +- query a domain record specified by the DNS zone (`domain.tld`) and the unique record ID (`11111111-1111-1111-1111-111111111111`). + +```hcl +# Query record by DNS zone, record name, type and content +data "scaleway_domain_record" "by_content" { + dns_zone = "domain.tld" + name = "www" + type = "A" + data = "1.2.3.4" +} + +# Query record by DNS zone and record ID +data "scaleway_domain_record" "by_id" { + dns_zone = "domain.tld" + record_id = "11111111-1111-1111-1111-111111111111" +} +``` + +## Argument Reference + +This section lists the arguments that you can provide to the `scaleway_domain_record` data source to filter and retrieve the desired record: + +- `dns_zone` - (Optional) The DNS zone (domain) to which the record belongs. This is a required field in both examples above but is optional in the context of defining the data source. + +- `name` - (Required when not using `record_id`) The name of the record, which can be an empty string for a root record. Cannot be used with `record_id`. + +- `type` - (Required when not using `record_id`) The type of the record (`A`, `AAAA`, `MX`, `CNAME`, etc.). Cannot be used with `record_id`. + +- `data` - (Required when not using `record_id`) The content of the record (e.g., an IPv4 address for an `A` record or a string for a `TXT` record). Cannot be used with `record_id`. + +- `record_id` - (Optional) The unique identifier of the record. Cannot be used with `name`, `type`, and `data`. + +- `project_id` - (Defaults to the Project ID specified in the [provider configuration](../index.md#project_id)). The ID of the Project associated with the domain. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +- `id` - The unique identifier of the record. + +~> **Important:** Domain records' IDs are formatted as `{dns_zone}/{id}` (e.g. `subdomain.domain.tld/11111111-1111-1111-1111-111111111111`). + +- `ttl` - The Time To Live (TTL) of the record in seconds. +- `priority` - The priority of the record, mainly used with `MX` records. +- `geo_ip` - Information about dynamic records based on user geolocation. [Find out more about dynamic records](../resources/domain_record.md#dynamic-records). +- `http_service` - Information about dynamic records based on URL resolution. [Find out more about dynamic records](../resources/domain_record.md#dynamic-records). +- `weighted` - Information about dynamic records based on IP weights. [Find out more about dynamic records](../resources/domain_record.md#dynamic-records). +- `view` - Information about dynamic records based on the client’s (resolver) subnet. [Find out more about dynamic records](../resources/domain_record.md#dynamic-records). diff --git a/templates/data-sources/domain_zone.md.tmpl b/templates/data-sources/domain_zone.md.tmpl new file mode 100644 index 0000000000..aaf6e59f3f --- /dev/null +++ b/templates/data-sources/domain_zone.md.tmpl @@ -0,0 +1,53 @@ +--- +subcategory: "Domains and DNS" +page_title: "Scaleway: scaleway_domain_zone" +--- + +# scaleway_domain_zone + +The `scaleway_domain_zone` data source is used to get information about a DNS zone within a specific domain and subdomain in Scaleway Domains and DNS. + +Refer to the Domains and DNS [product documentation](https://www.scaleway.com/en/docs/network/domains-and-dns/) and [API documentation](https://www.scaleway.com/en/developers/api/domains-and-dns/) for more information. + +## Example Usage + +### Query a domain zone + +The following command allows you to retrieve information about the DNS zone for the subdomain `test` within the domain `scaleway-terraform.com`. + +```hcl +# Get zone +data "scaleway_domain_zone" "main" { + domain = "scaleway-terraform.com" + subdomain = "test" +} +``` + +## Argument Reference + +This section lists the arguments that you can provide to the `scaleway_domain_zone` data source to filter and retrieve the desired DNS zone: + + +- `domain` - (Required) The primary domain name where the DNS zone is located. This is a mandatory field. + +- `subdomain` - (Required) The subdomain (or zone name) within the primary domain. This is a mandatory field. + +- `project_id` - (Defaults to Project ID specified in [the provider configuration](../index.md#project_id)). The ID of the Scaleway Project associated with the domain. If not specified, it defaults to the `project_id` set in the provider configuration. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +- `id` - The unique identifier of the zone, in the `{subdomain}.{domain}` format. + +- `ns` - The list of name servers for the zone. + +- `ns_default` - The default list of name servers for the zone. + +- `ns_master` - The master list of name servers for the zone. + +- `status` - The status of the domain zone. + +- `message` - Message associated with the domain zone (typically used for status or error messages). + +- `updated_at` - The date and time of the last update to the DNS zone. diff --git a/templates/data-sources/flexible_ip.md.tmpl b/templates/data-sources/flexible_ip.md.tmpl new file mode 100644 index 0000000000..b32c7d1d27 --- /dev/null +++ b/templates/data-sources/flexible_ip.md.tmpl @@ -0,0 +1,36 @@ +--- +subcategory: "Elastic Metal" +page_title: "Scaleway: scaleway_flexible_ip" +--- + +# scaleway_flexible_ip + +Gets information about a Flexible IP. + +## Example Usage + +```hcl +# Get info by IP address +data "scaleway_flexible_ip" "with_ip" { + ip_address = "1.2.3.4" +} + +# Get info by IP ID +data "scaleway_flexible_ip" "with_id" { + flexible_ip_id = "11111111-1111-1111-1111-111111111111" +} +``` + +## Argument Reference + +- `ip_address` - (Optional) The IP address. + Only one of `ip_address` and `flexible_ip_id` should be specified. + +- `flexible_ip_id` - (Optional) The IP ID. + Only one of `ip_address` and `flexible_ip_id` should be specified. + +- `project_id` - (Optional. Defaults to [provider](../index.md#project_id) `project_id`) The ID of the Project the Flexible IP is associated with. + +## Attributes Reference + +Exported attributes are the ones from `flexible_ip` [resource](../resources/flexible_ip.md) diff --git a/templates/data-sources/flexible_ips.md.tmpl b/templates/data-sources/flexible_ips.md.tmpl new file mode 100644 index 0000000000..40ada4d4a6 --- /dev/null +++ b/templates/data-sources/flexible_ips.md.tmpl @@ -0,0 +1,75 @@ +--- +subcategory: "Elastic Metal" +page_title: "Scaleway: scaleway_flexible_ips" +--- + +# scaleway_flexible_ips + +Gets information about multiple Flexible IPs. + +## Example Usage + +```hcl +# Find ips that share the same tags +data "scaleway_flexible_ips" "fips_by_tags" { + tags = ["a tag"] +} + +# Find ips that share the same Server ID +data "scaleway_baremetal_offer" "my_offer" { + name = "EM-B112X-SSD" +} + +resource "scaleway_baremetal_server" "base" { + name = "MyServer" + offer = data.scaleway_baremetal_offer.my_offer.offer_id + install_config_afterward = true +} + +resource "scaleway_flexible_ip" "first" { + server_id = scaleway_baremetal_server.base.id + tags = ["foo", "first"] +} + +resource "scaleway_flexible_ip" "second" { + server_id = scaleway_baremetal_server.base.id + tags = ["foo", "second"] +} + +data "scaleway_flexible_ips" "fips_by_server_id" { + server_ids = [scaleway_baremetal_server.base.id] + depends_on = [scaleway_flexible_ip.first, scaleway_flexible_ip.second] +} +``` + +## Argument Reference + +- `server_ids` - (Optional) List of server IDs used as filter. IPs with these exact server IDs are listed. + +- `tags` - (Optional) List of tags used as filter. IPs with these exact tags are listed. + +- `zone` - (Defaults to [provider](../index.md#zone) `zone`) The [zone](../guides/regions_and_zones.md#zones) in which IPs exist. + +## Attributes Reference + +In addition to all above arguments, the following attributes are exported: + +- `ips` - List of found flexible IPS + - `id` - The associated flexible IP ID. + - `description` - The description of the flexible IP. + - `tags` - The list of tags which are attached to the flexible IP. + - `status` - The status of the flexible IP. + - `mac_address` - The MAC address of the server associated with this flexible IP. + - `id` - The MAC address ID. + - `mac_address` - The MAC address of the Virtual MAC. + - `mac_type` - The type of virtual MAC. + - `status` - The status of virtual MAC. + - `created_at` - The date on which the virtual MAC was created (RFC 3339 format). + - `updated_at` - The date on which the virtual MAC was last updated (RFC 3339 format). + - `zone` - (Defaults to [provider](../index.md#zone) `zone`) The [zone](../guides/regions_and_zones.md#zones) in which the MAC address exist. + - `created_at` - The date on which the flexible IP was created (RFC 3339 format). + - `updated_at` - The date on which the flexible IP was last updated (RFC 3339 format). + - `reverse` - The reverse domain associated with this IP. + - `server_id` - The associated server ID if any. + - `organization_id` - (Defaults to [provider](../index.md#organization_id) `organization_id`) The ID of the organization the IP is in. + - `project_id` - (Defaults to [provider](../index.md#project_id) `project_id`) The ID of the project the IP is in. diff --git a/templates/data-sources/function.md.tmpl b/templates/data-sources/function.md.tmpl new file mode 100644 index 0000000000..2100bebcf3 --- /dev/null +++ b/templates/data-sources/function.md.tmpl @@ -0,0 +1,51 @@ +--- +subcategory: "Functions" +page_title: "Scaleway: scaleway_function" +--- + +# scaleway_function + +The `scaleway_function` data source is used to retrieve information about a Serverless Function. + +Refer to the Serverless Functions [product documentation](https://www.scaleway.com/en/docs/serverless/functions/) and [API documentation](https://www.scaleway.com/en/developers/api/serverless-functions/) for more information. + +For more information on the limitations of Serverless Functions, refer to the [dedicated documentation](https://www.scaleway.com/en/docs/compute/functions/reference-content/functions-limitations/). + +## Retrieve a Serverless Function + +The following commands allow you to: + +- retrieve a function by its name +- retrieve a function by its ID + +```terraform +// Get info by function name +data "scaleway_function" "my_function" { + name = "my-namespace-name" + namespace_id = "11111111-1111-1111-1111-111111111111" +} + +// Get info by function ID +data "scaleway_function" "my_function" { + function_id = "11111111-1111-1111-1111-111111111111" + namespace_id = "11111111-1111-1111-1111-111111111111" +} +``` + +## Argument Reference + +This section lists the arguments that you can provide to the `scaleway_function` data source to filter and retrieve the desired namespace. Each argument has a specific purpose: + +- `namespace_id` - (Required) The namespace ID associated with this function. + +- `name` - (Optional) The name of the function. Only one of `name` and `namespace_id` should be specified. + +- `function_id` - (Optional) The unique identifier of the function. Only one of `name` and `function_id` should be specified. + +- `region` - (Defaults to the region specified in the [provider configuration](../index.md#region) `region`) The [region](../guides/regions_and_zones.md#regions) in which the container exists. + +- `project_id` - (Optional) The unique identifier of the project with which the function is associated. + +## Attributes Reference + +The `scaleway_function` data source exports certain attributes once the function information is retrieved. These attributes can be referenced in other parts of your Terraform configuration. The exported attributes come from the `scaleway_function` [resource](../resources/function.md). diff --git a/templates/data-sources/function_namespace.md.tmpl b/templates/data-sources/function_namespace.md.tmpl new file mode 100644 index 0000000000..587192e3ff --- /dev/null +++ b/templates/data-sources/function_namespace.md.tmpl @@ -0,0 +1,57 @@ +--- +subcategory: "Functions" +page_title: "Scaleway: scaleway_function_namespace" +--- + +# scaleway_function_namespace + +The `scaleway_function_namespace` data source is used to retrieve information about a Serverless Functions namespace. + +Refer to the Serverless Functions [product documentation](https://www.scaleway.com/en/docs/serverless/functions/) and [API documentation](https://www.scaleway.com/en/developers/api/serverless-functions/) for more information. + +## Retrieve a Serverless Functions namespace + +The following commands allow you to: + +- retrieve a namespace by its name +- retrieve a namespace by its ID + +```hcl +// Get info by namespace name +data "scaleway_function_namespace" "my_namespace" { + name = "my-namespace-name" +} + +// Get info by namespace ID +data "scaleway_function_namespace" "my_namespace" { + namespace_id = "11111111-1111-1111-1111-111111111111" +} +``` + +## Argument Reference + +This section lists the arguments that you can provide to the `scaleway_function_namespace` data source to filter and retrieve the desired namespace. Each argument has a specific purpose: + +- `name` - (Optional) The name of the namespace. Only one of `name` and `namespace_id` should be specified. + +- `namespace_id` - (Optional) The unique identifier of the namespace. Only one of `name` and `namespace_id` should be specified. + +- `region` - (Defaults to the region specified in the [provider configuration](../index.md#region) `region`) The [region](../guides/regions_and_zones.md#regions) in which the namespace exists. + +- `project_id` - (Defaults to [provider](../index.md#project_id) `project_id`) The unique identifier of the project with which the namespace is associated. + +## Attributes Reference + +The `scaleway_function_namespace` data source exports certain attributes once the namespace information is retrieved. These attributes can be referenced in other parts of your Terraform configuration. + +In addition to the arguments above, the following attributes are exported: + +- `id` - The unique identifier of the function namespace. + +~> **Important:** Serverless Functions namespace IDs are [regional](../guides/regions_and_zones.md#resource-ids), which means they are expressed in the form `{region}/{id}`, e.g. `fr-par/11111111-1111-1111-1111-111111111111` + +- `organization_id` - The unique identifier of the organization with which the namespace is associated. +- `description` - The description of the namespace. +- `environment_variables` - The environment variables of the namespace. +- `registry_endpoint` - The registry endpoint of the namespace. +- `registry_namespace_id` - The unique identifier of the registry namespace of the Serverless Functions namespace. diff --git a/templates/data-sources/iam_api_key.md.tmpl b/templates/data-sources/iam_api_key.md.tmpl new file mode 100644 index 0000000000..5757fad1bb --- /dev/null +++ b/templates/data-sources/iam_api_key.md.tmpl @@ -0,0 +1,25 @@ +--- +subcategory: "IAM" +page_title: "Scaleway: scaleway_iam_api_key" +--- + +# scaleway_iam_api_key + +Gets information about an existing IAM API key. For more information, refer to the [IAM API documentation](https://www.scaleway.com/en/developers/api/iam/#api-keys-3665ae). + +## Example Usage + +```hcl +# Get api key infos by id (access_key) +data "scaleway_iam_api_key" "main" { + access_key = "SCWABCDEFGHIJKLMNOPQ" +} +``` + +## Argument Reference + +- `access_key` - The access key of the IAM API key which is also the ID of the API key. + +## Attribute Reference + +Exported attributes are the ones from `iam_api_key` [resource](../resources/iam_api_key.md) except the `secret_key` field diff --git a/templates/data-sources/iam_application.md.tmpl b/templates/data-sources/iam_application.md.tmpl new file mode 100644 index 0000000000..781bfaefc0 --- /dev/null +++ b/templates/data-sources/iam_application.md.tmpl @@ -0,0 +1,36 @@ +--- +subcategory: "IAM" +page_title: "Scaleway: scaleway_iam_application" +--- + +# scaleway_iam_application + +Gets information about an existing IAM application. + +## Example Usage + +```hcl +# Get info by name +data "scaleway_iam_application" "find_by_name" { + name = "foobar" +} +# Get info by application ID +data "scaleway_iam_application" "find_by_id" { + application_id = "11111111-1111-1111-1111-111111111111" +} +``` + +## Argument Reference + +- `name` - (Optional) The name of the IAM application. + +- `application_id` - (Optional) The ID of the IAM application. + + -> **Note** You must specify at least one: `name` and/or `application_id`. + +- `organization_id` - (Optional. Defaults to [provider](../index.md#organization_d) `organization_id`) The ID of the + Organization the application is associated with. + +## Attribute Reference + +Exported attributes are the ones from `iam_application` [resource](../resources/iam_application.md) diff --git a/templates/data-sources/iam_group.md.tmpl b/templates/data-sources/iam_group.md.tmpl new file mode 100644 index 0000000000..88efef3c61 --- /dev/null +++ b/templates/data-sources/iam_group.md.tmpl @@ -0,0 +1,39 @@ +--- +subcategory: "IAM" +page_title: "Scaleway: scaleway_iam_group" +--- + +# scaleway_iam_group + +Gets information about an existing IAM group. + +For more information, refer to the [IAM API documentation](https://developers.scaleway.com/en/products/iam/api/v1alpha1/#applications-83ce5e) + +## Example Usage + +```hcl +# Get info by name +data "scaleway_iam_group" "find_by_name" { + name = "foobar" +} + +# Get info by group ID +data "scaleway_iam_group" "find_by_id" { + group_id = "11111111-1111-1111-1111-111111111111" +} +``` + +## Argument Reference + +- `name` - (Optional) The name of the IAM group. + +- `group_id` - (Optional) The ID of the IAM group. + + -> **Note** You must specify at least one: `name` and/or `group_id`. + +- `organization_id` - (Optional. Defaults to [provider](../index.md#organization_d) `organization_id`) The ID of the + organization the group is associated with. + +## Attribute Reference + +Exported attributes are the ones from `iam_group` [resource](../resources/iam_group.md) diff --git a/templates/data-sources/iam_ssh_key.md.tmpl b/templates/data-sources/iam_ssh_key.md.tmpl new file mode 100644 index 0000000000..983c723dc3 --- /dev/null +++ b/templates/data-sources/iam_ssh_key.md.tmpl @@ -0,0 +1,43 @@ +--- +subcategory: "IAM" +page_title: "Scaleway: scaleway_iam_ssh_key" +--- + +# scaleway_iam_ssh_key + +Use this data source to get SSH key information based on its ID or name. + +## Example Usage + +```hcl +# Get info by SSH key name +data "scaleway_iam_ssh_key" "my_key" { + name = "my-key-name" +} + +# Get info by SSH key id +data "scaleway_iam_ssh_key" "my_key" { + ssh_key_id = "11111111-1111-1111-1111-111111111111" +} +``` + +## Argument Reference + +- `name` - The SSH key name. +- `ssh_key_id` - The SSH key id. + + -> **Note** You must specify at least one: `name` and/or `ssh_key_id`. + +- `project_id` (Optional. Defaults to [provider](../index.md#project_id) `project_id`) The ID of the project the SSH + key is associated with. + +## Attributes Reference + +In addition to all above arguments, the following attributes are exported: + +- `id` - The ID of the SSH public key. +- `public_key` - The SSH public key string +- `organization_id` - The ID of the organization the SSH key is associated with. +- `created_at` - The date and time of the creation of the SSH key. +- `updated_at` - The date and time of the last update of the SSH key. +- `disabled` - The SSH key status. diff --git a/templates/data-sources/iam_user.md.tmpl b/templates/data-sources/iam_user.md.tmpl new file mode 100644 index 0000000000..720f8da407 --- /dev/null +++ b/templates/data-sources/iam_user.md.tmpl @@ -0,0 +1,40 @@ +--- +subcategory: "IAM" +page_title: "Scaleway: scaleway_iam_user" +--- + +# scaleway_iam_user + +Use this data source to get information on an existing IAM user based on its ID or email address. +For more information refer to the [IAM API documentation](https://developers.scaleway.com/en/products/iam/api/v1alpha1/#users-06bdcf). + +## Example Usage + +```hcl +# Get info by user id +data "scaleway_iam_user" "find_by_id" { + user_id = "11111111-1111-1111-1111-111111111111" +} +# Get info by email address +data "scaleway_iam_user" "find_by_email" { + email = "foo@bar.com" +} +``` + +## Argument Reference + +- `email` - (Optional) The email address of the IAM user. +- `user_id` - (Optional) The ID of the IAM user. + + -> **Note** You must specify at least one: `email` and/or `user_id`. + +- `organization_id` - (Optional. Defaults to [provider](../index.md#organization_d) `organization_id`) The ID of the + organization the user is associated with. + +## Attributes Reference + +In addition to all above arguments, the following attributes are exported: + +- `id` - The ID of the IAM user. +- `tags` - The tags associated with the user. + diff --git a/templates/data-sources/inference_model.md.tmpl b/templates/data-sources/inference_model.md.tmpl new file mode 100644 index 0000000000..176b1545fb --- /dev/null +++ b/templates/data-sources/inference_model.md.tmpl @@ -0,0 +1,45 @@ +--- +subcategory: "Inference" +page_title: "Scaleway: scaleway_inference_model" +--- + +# scaleway_inference_model + +The `scaleway_inference_model` data source allows you to retrieve information about an inference model available in the Scaleway Inference API, either by providing the model's `name` or its `model_id`. + +## Example Usage + +### Basic + +```hcl +data "scaleway_inference_model" "my_model" { + name = "meta/llama-3.1-8b-instruct:fp8" +} +``` + +## Argument Reference + +You must provide either name or model_id, but not both. + +- `name` (Optional, Conflicts with model_id) The fully qualified name of the model to look up (e.g., "meta/llama-3.1-8b-instruct:fp8"). The provider will search for a model with an exact name match in the selected region and project. +- `model_id` (Optional, Conflicts with name) The ID of the model to retrieve. Must be a valid UUID with locality (i.e., Scaleway's zoned UUID format). +- `project_id` (Optional) The project ID to use when listing models. If not provided, the provider default project is used. +- `region` (Optional) The region where the model is hosted. If not set, the provider default region is used. + +## Attributes Reference + +In addition to the input arguments above, the following attributes are exported: + +- `id` - The unique identifier of the model. +- `tags` - Tags associated with the model. +- `status` - The current status of the model (e.g., ready, error, etc.). +- `description` - A textual description of the model (if available). +- `has_eula` - Whether the model requires end-user license agreement acceptance before use. +- `parameter_size_bits` - Size, in bits, of the model parameters. +- `size_bytes` - Total size, in bytes, of the model archive. +- `nodes_support` - List of supported node types and their quantization options. Each entry contains: + - `node_type_name` - The type of node supported. + - `quantization` - A list of supported quantization options, including: + - `quantization_bits` - Number of bits used for quantization (e.g., 8, 16). + - `allowed` - Whether this quantization is allowed. + - `max_context_size` - Maximum context length supported by this quantization. \ No newline at end of file diff --git a/templates/data-sources/instance_image.md.tmpl b/templates/data-sources/instance_image.md.tmpl new file mode 100644 index 0000000000..eec6aff1bc --- /dev/null +++ b/templates/data-sources/instance_image.md.tmpl @@ -0,0 +1,62 @@ +--- +subcategory: "Instances" +page_title: "Scaleway: scaleway_instance_image" +--- + +# scaleway_instance_image + +Gets information about an instance image. + +## Example Usage + +```hcl +# Get info by image name +data "scaleway_instance_image" "my_image" { + name = "my-image-name" +} + +# Get info by image id +data "scaleway_instance_image" "my_image" { + image_id = "11111111-1111-1111-1111-111111111111" +} +``` + +## Argument Reference + +- `name` - (Optional) The image name. Only one of `name` and `image_id` should be specified. + +- `image_id` - (Optional) The image id. Only one of `name` and `image_id` should be specified. + +- `architecture` - (Optional, default `x86_64`) The architecture the image is compatible with. Possible values are: `x86_64` or `arm`. + +- `latest` - (Optional, default `true`) Use the latest image ID. + +- `zone` - (Defaults to [provider](../index.md#zone) `zone`) The [zone](../guides/regions_and_zones.md#zones) in which the image exists. + +## Attributes Reference + +In addition to all above arguments, the following attributes are exported: + +- `id` - The ID of the image. + +~> **Important:** Instance images' IDs are [zoned](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{zone}/{id}`, e.g. `fr-par-1/11111111-1111-1111-1111-111111111111` + +- `organization_id` - The ID of the organization the image is associated with. + +- `project_id` - The ID of the project the image is associated with. + +- `creation_date` - Date of the image creation. + +- `modification_date` - Date of image latest update. + +- `public` - Set to `true` if the image is public. + +- `from_server_id` - ID of the server the image if based from. + +- `state` - State of the image. Possible values are: `available`, `creating` or `error`. + +- `default_bootscript_id` - ID of the default bootscript for this image. + +- `root_volume_id` - ID of the root volume in this image. + +- `additional_volume_ids` - IDs of the additional volumes in this image. diff --git a/templates/data-sources/instance_ip.md.tmpl b/templates/data-sources/instance_ip.md.tmpl new file mode 100644 index 0000000000..ddd6f124a1 --- /dev/null +++ b/templates/data-sources/instance_ip.md.tmpl @@ -0,0 +1,48 @@ +--- +subcategory: "Instances" +page_title: "Scaleway: scaleway_instance_ip" +--- + +# scaleway_instance_ip + +Gets information about an instance IP. + +## Example Usage + +```hcl +# Get info by IP address +data "scaleway_instance_ip" "my_ip" { + address = "0.0.0.0" +} + +# Get info by ID +data "scaleway_instance_ip" "my_ip" { + id = "fr-par-1/11111111-1111-1111-1111-111111111111" +} +``` + +## Argument Reference + +- `address` - (Optional) The IPv4 address to retrieve + Only one of `address` and `id` should be specified. + +- `id` - (Optional) The ID of the IP address to retrieve + Only one of `address` and `id` should be specified. + +- `zone` - (Defaults to [provider](../index.md#zone) `zone`) The [zone](../guides/regions_and_zones.md#zones) in which the IP should be reserved. + +- `project_id` - (Defaults to [provider](../index.md#project_id) `project_id`) The ID of the project the IP is associated with. + +## Attributes Reference + +In addition to all above arguments, the following attributes are exported: + +- `id` - The ID of the IP. + +~> **Important:** Instance IPs' IDs are [zoned](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{zone}/{id}`, e.g. `fr-par-1/11111111-1111-1111-1111-111111111111` + +- `type` - The type of the IP +- `address` - The IP address. +- `prefix` - The IP Prefix. +- `reverse` - The reverse dns attached to this IP +- `organization_id` - The organization ID the IP is associated with. diff --git a/templates/data-sources/instance_placement_group.md.tmpl b/templates/data-sources/instance_placement_group.md.tmpl new file mode 100644 index 0000000000..575ef6e4e5 --- /dev/null +++ b/templates/data-sources/instance_placement_group.md.tmpl @@ -0,0 +1,44 @@ +--- +subcategory: "Instances" +page_title: "Scaleway: scaleway_instance_placement_group" +--- + +# scaleway_instance_placement_group + +Gets information about a Security Group. + +## Example Usage + +```hcl +# Get info by placement group name +data "scaleway_instance_placement_group" "my_key" { + name = "my-placement-group-name" +} + +# Get info by placement group id +data "scaleway_instance_placement_group" "my_key" { + placement_group_id = "11111111-1111-1111-1111-111111111111" +} +``` + +## Argument Reference + +- `name` - (Optional) The placement group name. Only one of `name` and `placement_group_id` should be specified. + +- `placement_group_id` - (Optional) The placement group id. Only one of `name` and `placement_group_id` should be specified. + +- `project_id` - (Defaults to [provider](../index.md#project_id) `project_id`) The ID of the project the placement group is associated with. + +- `zone` - (Defaults to [provider](../index.md#zone) `zone`) The [zone](../guides/regions_and_zones.md#zones) in which the placement group exists. + +## Attributes Reference + +In addition to all above arguments, the following attributes are exported: + +- `id` - The ID of the placement group. + +- `policy_type` - The [policy type](https://developers.scaleway.com/en/products/instance/api/#placement-groups-d8f653) of the placement group. +- `policy_mode` -The [policy mode](https://developers.scaleway.com/en/products/instance/api/#placement-groups-d8f653) of the placement group. +- `tags` - A list of tags to apply to the placement group. +- `policy_respected` - Is true when the policy is respected. +- `organization_id` - The organization ID the placement group is associated with. diff --git a/templates/data-sources/instance_private_nic.md.tmpl b/templates/data-sources/instance_private_nic.md.tmpl new file mode 100644 index 0000000000..b7a7bcfabe --- /dev/null +++ b/templates/data-sources/instance_private_nic.md.tmpl @@ -0,0 +1,46 @@ +--- +subcategory: "Instances" +page_title: "Scaleway: scaleway_instance_private_nic" +--- + +# scaleway_instance_private_nic + +Gets information about an instance private NIC. + +## Example Usage + +```hcl +data "scaleway_instance_private_nic" "by_nic_id" { + server_id = "11111111-1111-1111-1111-111111111111" + private_nic_id = "11111111-1111-1111-1111-111111111111" +} + +data "scaleway_instance_private_nic" "by_pn_id" { + server_id = "11111111-1111-1111-1111-111111111111" + private_network_id = "11111111-1111-1111-1111-111111111111" +} + +data "scaleway_instance_private_nic" "by_tags" { + server_id = "11111111-1111-1111-1111-111111111111" + tags = ["mytag"] +} +``` + +## Argument Reference + +- `server_id` - (Required) The server's id + +- `tags` (Optional) The tags associated with the private NIC. + As datasource only returns one private NIC, the search with given tags must return only one result + +- `private_nic_id` - (Optional) The ID of the instance server private nic + Only one of `private_nic_id` and `private_network_id` should be specified. + +- `private_network_id` - (Optional) The ID of the private network + Only one of `private_nic_id` and `private_network_id` should be specified. + +- `zone` - (Defaults to [provider](../index.md#zone) `zone`) The [zone](../guides/regions_and_zones.md#zones) in which the private nic exists. + +## Attributes Reference + +Exported attributes are the ones from `instance_private_nic` [resource](../resources/instance_private_nic.md) diff --git a/templates/data-sources/instance_security_group.md.tmpl b/templates/data-sources/instance_security_group.md.tmpl new file mode 100644 index 0000000000..b2c3a15131 --- /dev/null +++ b/templates/data-sources/instance_security_group.md.tmpl @@ -0,0 +1,66 @@ +--- +subcategory: "Instances" +page_title: "Scaleway: scaleway_instance_security_group" +--- + +# scaleway_instance_security_group + +Gets information about a Security Group. + +## Example Usage + +```hcl +# Get info by security group name +data "scaleway_instance_security_group" "my_key" { + name = "my-security-group-name" +} + +# Get info by security group id +data "scaleway_instance_security_group" "my_key" { + security_group_id = "11111111-1111-1111-1111-111111111111" +} +``` + +## Argument Reference + +- `name` - (Optional) The security group name. Only one of `name` and `security_group_id` should be specified. + +- `security_group_id` - (Optional) The security group id. Only one of `name` and `security_group_id` should be specified. + +- `zone` - (Defaults to [provider](../index.md#zone) `zone`) The [zone](../guides/regions_and_zones.md#zones) in which the security group exists. + +- `project_id` - (Optional) The ID of the project the security group is associated with. + +## Attributes Reference + +In addition to all above arguments, the following attributes are exported: + +- `id` - The ID of the security group. + +~> **Important:** Instance security groups' IDs are [zoned](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{zone}/{id}`, e.g. `fr-par-1/11111111-1111-1111-1111-111111111111` + +- `organization_id` - The ID of the organization the security group is associated with. + +- `inbound_default_policy` - The default policy on incoming traffic. Possible values are: `accept` or `drop`. + +- `outbound_default_policy` - The default policy on outgoing traffic. Possible values are: `accept` or `drop`. + +- `inbound_rule` - A list of inbound rule to add to the security group. (Structure is documented below.) + +- `outbound_rule` - A list of outbound rule to add to the security group. (Structure is documented below.) + +The `inbound_rule` and `outbound_rule` block supports: + +- `action` - The action to take when rule match. Possible values are: `accept` or `drop`. + +- `protocol`- The protocol this rule apply to. Possible values are: `TCP`, `UDP`, `ICMP` or `ANY`. + +- `port`- The port this rule apply to. If no port is specified, rule will apply to all port. + +- `port_range`- The port range (e.g `22-23`) this rule applies to. + If no `port` nor `port_range` are specified, rule will apply to all port. + Only one of `port` and `port_range` should be specified. + +- `ip`- The ip this rule apply to. + +- `ip_range`- The ip range (e.g `192.168.1.0/24`) this rule apply to. diff --git a/templates/data-sources/instance_server.md.tmpl b/templates/data-sources/instance_server.md.tmpl new file mode 100644 index 0000000000..4da026f99d --- /dev/null +++ b/templates/data-sources/instance_server.md.tmpl @@ -0,0 +1,93 @@ +--- +subcategory: "Instances" +page_title: "Scaleway: scaleway_instance_server" +--- + +# scaleway_instance_server + +Gets information about an instance server. + +## Example Usage + +```hcl +# Get info by server name +data "scaleway_instance_server" "my_key" { + name = "my-server-name" +} + +# Get info by server id +data "scaleway_instance_server" "my_key" { + server_id = "11111111-1111-1111-1111-111111111111" +} +``` + +## Argument Reference + +- `name` - (Optional) The server name. Only one of `name` and `server_id` should be specified. + +- `server_id` - (Optional) The server id. Only one of `name` and `server_id` should be specified. + +- `zone` - (Defaults to [provider](../index.md#zone) `zone`) The [zone](../guides/regions_and_zones.md#zones) in which the server exists. + +- `project_id` - (Optional) The ID of the project the instance server is associated with. + +## Attributes Reference + +In addition to all above arguments, the following attributes are exported: + +- `id` - The ID of the server. + +~> **Important:** Instance servers' IDs are [zoned](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{zone}/{id}`, e.g. `fr-par-1/11111111-1111-1111-1111-111111111111` + +- `type` - The commercial type of the server. +You find all the available types on the [pricing page](https://www.scaleway.com/en/pricing/). + +- `image` - The UUID and the label of the base image used by the server. + +- `organization_id` - The ID of the organization the server is associated with. + +- `tags` - The tags associated with the server. + +- `security_group_id` - The [security group](https://developers.scaleway.com/en/products/instance/api/#security-groups-8d7f89) the server is attached to. + +- `placement_group_id` - The [placement group](https://developers.scaleway.com/en/products/instance/api/#placement-groups-d8f653) the server is attached to. + +- `root_volume` - Root [volume](https://developers.scaleway.com/en/products/instance/api/#volumes-7e8a39) attached to the server on creation. + - `size_in_gb` - Size of the root volume in gigabytes. + - `delete_on_termination` - Forces deletion of the root volume on instance termination. + +- `additional_volume_ids` - The [additional volumes](https://developers.scaleway.com/en/products/instance/api/#volumes-7e8a39) +attached to the server. + +- `enable_ipv6` - Determines if IPv6 is enabled for the server. + +- `enable_dynamic_ip` - True if dynamic IP in enable on the server. + +- `state` - The state of the server. Possible values are: `started`, `stopped` or `standby`. + +- `cloud_init` - The cloud init script associated with this server. + +- `user_data` - The user data associated with the server. + + - `key` - The user data key. The `cloud-init` key is reserved, please use `cloud_init` attribute instead. + + - `value` - The user data content. + +- `placement_group_policy_respected` - True when the placement group policy is respected. + +- `root_volume` + - `volume_id` - The volume ID of the root volume of the server. + +- `private_ip` - The Scaleway internal IP address of the server. + +- `public_ip` - The public IP address of the server. + +- `public_ips` - The list of public IPs of the server + - `id` - The ID of the IP + - `address` - The address of the IP + +- `ipv6_address` - The default ipv6 address routed to the server. ( Only set when enable_ipv6 is set to true ) + +- `ipv6_gateway` - The ipv6 gateway address. ( Only set when enable_ipv6 is set to true ) + +- `ipv6_prefix_length` - The prefix length of the ipv6 subnet routed to the server. ( Only set when enable_ipv6 is set to true ) diff --git a/templates/data-sources/instance_servers.md.tmpl b/templates/data-sources/instance_servers.md.tmpl new file mode 100644 index 0000000000..e5cd2cd9cd --- /dev/null +++ b/templates/data-sources/instance_servers.md.tmpl @@ -0,0 +1,72 @@ +--- +subcategory: "Instances" +page_title: "Scaleway: scaleway_instance_servers" +--- + +# scaleway_instance_servers + +Gets information about multiple instance servers. + +## Examples + +### Basic + +```hcl +# Find servers by tag +data "scaleway_instance_servers" "my_key" { + tags = ["tag"] +} + +# Find servers by name and zone +data "scaleway_instance_servers" "my_key" { + name = "myserver" + zone = "fr-par-2" +} +``` + +## Argument Reference + +- `name` - (Optional) The server name used as filter. Servers with a name like it are listed. + +- `tags` - (Optional) List of tags used as filter. Servers with these exact tags are listed. + +- `zone` - (Defaults to [provider](../index.md#zone) `zone`) The [zone](../guides/regions_and_zones.md#zones) in which servers exist. + +## Attributes Reference + +In addition to all above arguments, the following attributes are exported: + +- `id` - The zone of the servers + +- `servers` - List of found servers + - `id` - The ID of the server. + + ~> **Important:** Instance servers' IDs are [zoned](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{zone}/{id}`, e.g. `fr-par-1/11111111-1111-1111-1111-111111111111` + + - `tags` - The tags associated with the server. + - `public_ip` - The public IP address of the server. + - `private_ip` - The Scaleway internal IP address of the server. + - `private_ips` - The list of private IPv4 and IPv6 addresses associated with the server. + - `id` - The ID of the IP address resource. + - `address` - The private IP address. + - `public_ips` - The list of public IPs of the server + - `id` - The ID of the IP + - `address` - The address of the IP + - `prefix` - The public IP prefix of the server. + - `state` - The state of the server. Possible values are: `started`, `stopped` or `standby`. + - `zone` - The [zone](../guides/regions_and_zones.md#zones) in which the server is. + - `name` - The name of the server. + - `boot_type` - The boot Type of the server. Possible values are: `local`, `bootscript` or `rescue`. + - `type` - The commercial type of the server. + - `security_group_id` - The [security group](https://developers.scaleway.com/en/products/instance/api/#security-groups-8d7f89) the server is attached to. + - `enable_ipv6` - Determines if IPv6 is enabled for the server. + - `ipv6_address` - The default ipv6 address routed to the server. ( Only set when enable_ipv6 is set to true ) + - `ipv6_gateway` - The ipv6 gateway address. ( Only set when enable_ipv6 is set to true ) + - `ipv6_prefix_length` - The prefix length of the ipv6 subnet routed to the server. ( Only set when enable_ipv6 is set to true ) + - `enable_dynamic_ip` - If true a dynamic IP will be attached to the server. + - `image` - The UUID or the label of the base image used by the server. + - `placement_group_id` - The [placement group](https://developers.scaleway.com/en/products/instance/api/#placement-groups-d8f653) the server is attached to. + - `organization_id` - The organization ID the server is associated with. + - `project_id` - The ID of the project the server is associated with. + + diff --git a/templates/data-sources/instance_snapshot.md.tmpl b/templates/data-sources/instance_snapshot.md.tmpl new file mode 100644 index 0000000000..e9b0528d3c --- /dev/null +++ b/templates/data-sources/instance_snapshot.md.tmpl @@ -0,0 +1,40 @@ +--- +subcategory: "Instances" +page_title: "Scaleway: scaleway_instance_snapshot" +--- + +# scaleway_instance_snapshot + +Gets information about an instance snapshot. + +## Example Usage + +```hcl +# Get info by snapshot name +data "scaleway_instance_snapshot" "by_name" { + name = "my-snapshot-name" +} + +# Get info by snapshot ID +data "scaleway_instance_snapshot" "by_id" { + snapshot_id = "11111111-1111-1111-1111-111111111111" +} +``` + +## Argument Reference + +- `name` - (Optional) The snapshot name. + Only one of `name` and `snapshot_id` should be specified. + +- `snapshot_id` - (Optional) The snapshot id. + Only one of `name` and `snapshot_id` should be specified. + +- `zone` - (Defaults to [provider](../index.md#zone) `zone`) The [zone](../guides/regions_and_zones.md#zones) in which the snapshot exists. + + +- `project_id` - (Defaults to [provider](../index.md#project_id) `project_id`) The ID of the project the snapshot is associated with. + +## Attributes Reference + +Exported attributes are the ones from `instance_snapshot` [resource](../resources/instance_snapshot.md) + diff --git a/templates/data-sources/instance_volume.md.tmpl b/templates/data-sources/instance_volume.md.tmpl new file mode 100644 index 0000000000..619354896f --- /dev/null +++ b/templates/data-sources/instance_volume.md.tmpl @@ -0,0 +1,58 @@ +--- +subcategory: "Instances" +page_title: "Scaleway: scaleway_instance_volume" +--- + +# scaleway_instance_volume + +Gets information about an instance volume. + +## Example Usage + +```hcl +# Get info by volume name +data "scaleway_instance_volume" "my_volume" { + name = "my-volume-name" +} + +# Get info by volume ID +data "scaleway_instance_volume" "my_volume" { + volume_id = "11111111-1111-1111-1111-111111111111" +} +``` + +## Argument Reference + +- `name` - (Optional) The volume name. + Only one of `name` and `volume_id` should be specified. + +- `volume_id` - (Optional) The volume id. + Only one of `name` and `volume_id` should be specified. + +- `zone` - (Defaults to [provider](../index.md#zone) `zone`) The [zone](../guides/regions_and_zones.md#zones) in which the volume exists. + +- `project_id` - (Optional) The ID of the project the volume is associated with. + +## Attributes Reference + +In addition to all above arguments, the following attributes are exported: + +- `id` - The ID of the volume. + +~> **Important:** Instance volumes' IDs are [zoned](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{zone}/{id}`, e.g. `fr-par-1/11111111-1111-1111-1111-111111111111` + +- `volume_type` - The type of the volume. + `l_ssd` for local SSD, `b_ssd` for block storage SSD. + +- `creation_date` - Volume creation date. + +- `modification_date` - Volume last modification date. + +- `state` - State of the volume. Possible values are `available`, `snapshotting` and `error`. + The default value is available. + +- `size` - The volumes disk size (in bytes). + +- `server` - Information about the server attached to the volume. + +- `organization_id` - The ID of the organization the volume is associated with. diff --git a/templates/data-sources/iot_device.md.tmpl b/templates/data-sources/iot_device.md.tmpl new file mode 100644 index 0000000000..c257d55887 --- /dev/null +++ b/templates/data-sources/iot_device.md.tmpl @@ -0,0 +1,49 @@ +--- +subcategory: "IoT Hub" +page_title: "Scaleway: scaleway_iot_device" +--- + +# scaleway_iot_device + +Gets information about an IOT Device. + +## Example Usage + +```hcl +# Get info by name +data "scaleway_iot_device" "my_device" { + name = "foobar" +} + +# Get info by name and hub_id +data "scaleway_iot_device" "my_device" { + name = "foobar" + hub_id = "11111111-1111-1111-1111-111111111111" +} + +# Get info by device ID +data "scaleway_iot_device" "my_device" { + device_id = "11111111-1111-1111-1111-111111111111" +} + +``` + +## Argument Reference + +- `name` - (Optional) The name of the Hub. + Only one of the `name` and `device_id` should be specified. + +- `hub_id` - (Optional) The hub ID. + +- `device_id` - (Optional) The device ID. + Only one of the `name` and `device_id` should be specified. + +- `region` - (Default to [provider](../index.md) `region`) The [region](../guides/regions_and_zones.md#zones) in which the hub exists. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +- `id` - The ID of the device. + +~> **Important:** IoT devices' IDs are [regional](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{region}/{id}`, e.g. `fr-par/11111111-1111-1111-1111-111111111111` diff --git a/templates/data-sources/iot_hub.md.tmpl b/templates/data-sources/iot_hub.md.tmpl new file mode 100644 index 0000000000..8dbfa0d46e --- /dev/null +++ b/templates/data-sources/iot_hub.md.tmpl @@ -0,0 +1,43 @@ +--- +subcategory: "IoT Hub" +page_title: "Scaleway: scaleway_iot_hub" +--- + +# scaleway_iot_hub + +Gets information about an IOT Hub. + +## Example Usage + +```hcl +# Get info by name +data "scaleway_iot_hub" "my_hub" { + name = "foobar" +} + +# Get info by hub ID +data "scaleway_iot_hub" "my_hub" { + hub_id = "11111111-1111-1111-1111-111111111111" +} + +``` + +## Argument Reference + +- `name` - (Optional) The name of the Hub. + Only one of the `name` and `hub_id` should be specified. + +- `hub_id` - (Optional) The Hub ID. + Only one of the `name` and `hub_id` should be specified. + +- `region` - (Default to [provider](../index.md) `region`) The [region](../guides/regions_and_zones.md#zones) in which the hub exists. + +- `project_id` - (Optional) The ID of the project the hub is associated with. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +- `id` - The ID of the Hub. + +~> **Important:** IoT Hub instances' IDs are [regional](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{region}/{id}`, e.g. `fr-par/11111111-1111-1111-1111-111111111111` diff --git a/templates/data-sources/ipam_ip.md.tmpl b/templates/data-sources/ipam_ip.md.tmpl new file mode 100644 index 0000000000..43446c0680 --- /dev/null +++ b/templates/data-sources/ipam_ip.md.tmpl @@ -0,0 +1,115 @@ +--- +subcategory: "IPAM" +page_title: "Scaleway: scaleway_ipam_ip" +--- + +# scaleway_ipam_ip + +Gets information about IP addresses managed by Scaleway's IP Address Management (IPAM) service. IPAM is used for the DHCP bundled with VPC Private Networks. + +For more information about IPAM, see the main [documentation](https://www.scaleway.com/en/docs/vpc/concepts/#ipam). + +## Examples + +### IPAM IP ID + +```terraform +# Get info by ipam ip id +data "scaleway_ipam_ip" "by_id" { + ipam_ip_id = "11111111-1111-1111-1111-111111111111" +} +``` + +### Instance Private Network IP + +Get an Instance's IP on a Private Network. + +```terraform +# Connect your instance to a private network using a private nic. +resource "scaleway_instance_private_nic" "nic" { + server_id = scaleway_instance_server.server.id + private_network_id = scaleway_vpc_private_network.pn.id +} + +# Find server private IPv4 using private-nic mac address +data "scaleway_ipam_ip" "by_mac" { + mac_address = scaleway_instance_private_nic.nic.mac_address + type = "ipv4" +} + +# Find server private IPv4 using private-nic id +data "scaleway_ipam_ip" "by_id" { + resource { + id = scaleway_instance_private_nic.nic.id + type = "instance_private_nic" + } + type = "ipv4" +} + + +``` + +### RDB instance + +```terraform +# Find the private IPv4 using resource name +resource "scaleway_vpc_private_network" "pn" {} + +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" + private_network { + pn_id = scaleway_vpc_private_network.pn.id + } +} + +data "scaleway_ipam_ip" "by_name" { + resource { + name = scaleway_rdb_instance.main.name + type = "rdb_instance" + } + type = "ipv4" +} +``` + +## Argument Reference + +- `ipam_ip_id` - (Optional) The IPAM IP ID. Cannot be used with any other arguments. + +- `type` - (Optional) The type of IP to search for (`ipv4` or `ipv6`). Cannot be used with `ipam_ip_id`. + +- `private_network_id` - (Optional) The ID of the Private Network the IP belongs to. Cannot be used with `ipam_ip_id`. + +- `resource` - (Optional) Filter by resource ID, type or name. Cannot be used with `ipam_ip_id`. +If specified, `type` is required, and at least one of `id` or `name` must be set. + - `id` - The ID of the resource that the IP is attached to. + - `type` - The type of the resource the IP is attached to. [Documentation](https://pkg.go.dev/github.com/scaleway/scaleway-sdk-go@master/api/ipam/v1#pkg-constants) with type list. + - `name` - The name of the resource the IP is attached to. + +- `mac_address` - (Optional) The MAC address linked to the IP. Cannot be used with `ipam_ip_id`. + +- `region` - (Defaults to [provider](../index.md#zone) `region`) The [region](../guides/regions_and_zones.md#regions) in which the IP exists. + +- `tags` (Optional) The tags associated with the IP. Cannot be used with `ipam_ip_id`. + As datasource only returns one IP, the search with given tags must return only one result. + +- `zonal` - (Optional) Only IPs that are zonal, and in this zone, will be returned. + +- `attached` - (Optional) Defines whether to filter only for IPs which are attached to a resource. Cannot be used with `ipam_ip_id`. + +- `project_id` - (Defaults to [provider](../index.md#project_id) `project_id`) The ID of the Project the IP is associated with. + +- `organization_id` - (Defaults to [provider](../index.md#organization_id) `organization_id`) The ID of the Organization the IP is in. + +## Attributes Reference + +In addition to all above arguments, the following attributes are exported: + +- `id` - The ID of the IP in IPAM. +- `address` - The IP address. +- `address_cidr` - the IP address in CIDR notation. diff --git a/templates/data-sources/ipam_ips.md.tmpl b/templates/data-sources/ipam_ips.md.tmpl new file mode 100644 index 0000000000..55cfe6e106 --- /dev/null +++ b/templates/data-sources/ipam_ips.md.tmpl @@ -0,0 +1,104 @@ +--- +subcategory: "IPAM" +page_title: "Scaleway: scaleway_ipam_ips" +--- + +# scaleway_ipam_ips + +Gets information about multiple IP addresses managed by Scaleway's IP Address Management (IPAM) service. + +For more information about IPAM, see the main [documentation](https://www.scaleway.com/en/docs/vpc/concepts/#ipam). + +## Examples + +### By tag + +```terraform +data "scaleway_ipam_ips" "by_tag" { + tags = ["tag"] +} +``` + +### By type and resource + +```terraform +resource "scaleway_vpc" "vpc01" { + name = "my vpc" +} + +resource "scaleway_vpc_private_network" "pn01" { + vpc_id = scaleway_vpc.vpc01.id + ipv4_subnet { + subnet = "172.16.32.0/22" + } +} + +resource "scaleway_redis_cluster" "redis01" { + name = "my_redis_cluster" + version = "7.0.5" + node_type = "RED1-XS" + user_name = "my_initial_user" + password = "thiZ_is_v&ry_s3cret" + cluster_size = 3 + private_network { + id = scaleway_vpc_private_network.pn01.id + } +} + +data "scaleway_ipam_ips" "by_type_and_resource" { + type = "ipv4" + resource { + id = scaleway_redis_cluster.redis01.id + type = "redis_cluster" + } +} +``` + +## Argument Reference + +- `type` - (Optional) The type of IP to filter for (`ipv4` or `ipv6`). + +- `private_network_id` - (Optional) The ID of the Private Network to filter for. + +- `resource` - (Optional) Filter for a resource attached to the IP, using resource ID, type or name. + - `id` - The ID of the attached resource. + - `type` - The type of the attached resource. [Documentation](https://pkg.go.dev/github.com/scaleway/scaleway-sdk-go@master/api/ipam/v1#pkg-constants) with type list. + - `name` - The name of the attached resource. + +- `mac_address` - (Optional) The linked MAC address to filter for. + +- `tags` (Optional) The IP tags to filter for. + +- `attached` - (Optional) Defines whether to filter only for IPs which are attached to a resource. + +- `zonal` - (Optional) Only IPs that are zonal, and in this zone, will be returned. + +- `region` - (Optional) The region to filter for. + +- `project_id` - (Optional) The ID of the Project to filter for. + +- `organization_id` - (Optional) The ID of the Organization to filter for. + +## Attributes Reference + +In addition to all above arguments, the following attributes are exported: + +- `id` - The region of the IPs. +- `ips` - List of found IPs. + - `id` - The ID of the IP. + + ~> **Important:** IPAM IP IDs are [regional](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{region}/{id}`, e.g. `fr-par/11111111-1111-1111-1111-111111111111` + + - `address` - The Scaleway internal IP address of the resource. + - `resource` - The list of public IPs attached to the resource. + - `id` - The ID of the resource. + - `type` - The type of resource. + - `mac_address` - The associated MAC address. + - `name` - The name of the resource. + - `tags` - The tags associated with the IP. + - `created_at` - The date and time of the creation of the IP. + - `updated_at` - The date and time of the last update of the IP. + - `zone` - The [zone](../guides/regions_and_zones.md#zones) of the IP. + - `region` - The [region](../guides/regions_and_zones.md#regions) of the IP. + - `project_id` - The ID of the Project the resource is associated with. + diff --git a/templates/data-sources/k8s_cluster.md.tmpl b/templates/data-sources/k8s_cluster.md.tmpl new file mode 100644 index 0000000000..40934113e0 --- /dev/null +++ b/templates/data-sources/k8s_cluster.md.tmpl @@ -0,0 +1,108 @@ +--- +subcategory: "Kubernetes" +page_title: "Scaleway: scaleway_k8s_cluster" +--- + +# scaleway_k8s_cluster + +Gets information about a Kubernetes Cluster. + +## Example Usage + +```hcl +# Get info by cluster name +data "scaleway_k8s_cluster" "my_key" { + name = "my-cluster-name" +} + +# Get info by cluster id +data "scaleway_k8s_cluster" "my_key" { + cluster_id = "11111111-1111-1111-1111-111111111111" +} +``` + +## Argument Reference + +- `name` - (Optional) The cluster name. Only one of `name` and `cluster_id` should be specified. + +- `cluster_id` - (Optional) The cluster ID. Only one of `name` and `cluster_id` should be specified. + +- `region` - (Defaults to [provider](../index.md#region) `region`) The [region](../guides/regions_and_zones.md#regions) in which the cluster exists. + +- `project_id` - (Optional) The ID of the project the cluster is associated with. + +## Attributes Reference + +In addition to all above arguments, the following attributes are exported: + +- `id` - The ID of the cluster. + +~> **Important:** Kubernetes clusters' IDs are [regional](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{region}/{id}`, e.g. `fr-par/11111111-1111-1111-1111-111111111111` + +- `created_at` - The creation date of the cluster. + +- `updated_at` - The last update date of the cluster. + +- `apiserver_url` - The URL of the Kubernetes API server. + +- `wildcard_dns` - The DNS wildcard that points to all ready nodes. + +- `kubeconfig` + + - `config_file` - The raw kubeconfig file. + + - `host` - The URL of the Kubernetes API server. + + - `cluster_ca_certificate` - The CA certificate of the Kubernetes API server. + + - `token` - The token to connect to the Kubernetes API server. + +- `status` - The status of the Kubernetes cluster. + +- `type` - The type of the Kubernetes cluster. + +- `upgrade_available` - True if a newer Kubernetes version is available. + +- `description` - A description for the Kubernetes cluster. + +- `version` - The version of the Kubernetes cluster. + +- `cni` - The Container Network Interface (CNI) for the Kubernetes cluster. + +- `tags` - The tags associated with the Kubernetes cluster. + +- `autoscaler_config` - The configuration options for the [Kubernetes cluster autoscaler](https://github.com/kubernetes/autoscaler/tree/master/cluster-autoscaler). + + - `disable_scale_down` - True if the scale down feature of the autoscaler is disabled. + + - `scale_down_delay_after_add` - The duration after scale up that scale down evaluation resumes. + + - `scale_down_unneeded_time` - The duration a node should be unneeded before it is eligible for scale down. + + - `estimator` - The type of resource estimator used in scale up. + + - `expander` - The type of node group expander be used in scale up. + + - `ignore_daemonsets_utilization` - True if ignoring DaemonSet pods when calculating resource utilization for scaling down is enabled. + + - `balance_similar_node_groups` - True if detecting similar node groups and balance the number of nodes between them is enabled. + + - `expendable_pods_priority_cutoff` - Pods with priority below cutoff will be expendable. They can be killed without any consideration during scale down and they don't cause scale up. Pods with null priority (PodPriority disabled) are non expendable. + +- `auto_upgrade` - The auto upgrade configuration. + + - `enable` - True if Kubernetes patch version auto upgrades is enabled. + + - `maintenance_window_start_hour` - The start hour (UTC) of the 2-hour auto upgrade maintenance window (0 to 23). + + - `maintenance_window_day` - The day of the auto upgrade maintenance window (`monday` to `sunday`, or `any`). + +- `feature_gates` - The list of [feature gates](https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/) enabled on the cluster. + +- `admission_plugins` - The list of [admission plugins](https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/) enabled on the cluster. + +- `private_network_id` - The ID of the private network of the cluster. + +- `region` - The [region](../guides/regions_and_zones.md#regions) in which the cluster is. + +- `organization_id` - The ID of the organization the cluster is associated with. diff --git a/templates/data-sources/k8s_pool.md.tmpl b/templates/data-sources/k8s_pool.md.tmpl new file mode 100644 index 0000000000..6556cdfaeb --- /dev/null +++ b/templates/data-sources/k8s_pool.md.tmpl @@ -0,0 +1,79 @@ +--- +subcategory: "Kubernetes" +page_title: "Scaleway: scaleway_k8s_pool" +--- + +# scaleway_k8s_pool + +Gets information about a Kubernetes Cluster's Pool. + +## Example Usage + +```hcl +# Get info by pokl name (need cluster_id) +data "scaleway_k8s_pool" "my_key" { + name = "my-pool-name" + cluster_id = "11111111-1111-1111-1111-111111111111" +} + +# Get info by pool id +data "scaleway_k8s_pool" "my_key" { + pool_id = "11111111-1111-1111-1111-111111111111" +} +``` + +## Argument Reference + +- `name` - The pool name. Only one of `name` and `pool_id` should be specified. `cluster_id` should be specified with `name`. + +- `pool_id` - (Optional) The pool's ID. Only one of `name` and `pool_id` should be specified. + +- `cluster_id` - (Optional) The cluster ID. Required when `name` is set. + +- `region` - (Defaults to [provider](../index.md#region) `region`) The [region](../guides/regions_and_zones.md#regions) in which the pool exists. + +## Attributes Reference + +In addition to all above arguments, the following attributes are exported: + +- `id` - The ID of the pool. + +~> **Important:** Kubernetes clusters pools' IDs are [regional](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{region}/{id}`, e.g. `fr-par/11111111-1111-1111-1111-111111111111` + +- `status` - The status of the pool. + +- `nodes` - (List of) The nodes in the default pool. + + - `name` - The name of the node. + + - `public_ip` - The public IPv4. + + - `public_ip_v6` - The public IPv6. + + - `status` - The status of the node. + +- `created_at` - The creation date of the pool. + +- `updated_at` - The last update date of the pool. + +- `version` - The version of the pool. + +- `current_size` - The size of the pool at the time the terraform state was updated. + +- `node_type` - The commercial type of the pool instances. + +- `size` - The size of the pool. + +- `min_size` - The minimum size of the pool, used by the autoscaling feature. + +- `max_size` - The maximum size of the pool, used by the autoscaling feature. + +- `tags` - The tags associated with the pool. + +- `placement_group_id` - [placement group](https://developers.scaleway.com/en/products/instance/api/#placement-groups-d8f653) the nodes of the pool are attached to. + +- `autoscaling` - True if the autoscaling feature is enabled for this pool. + +- `autohealing` - True if the autohealing feature is enabled for this pool. + +- `container_runtime` - The container runtime of the pool. diff --git a/templates/data-sources/k8s_version.md.tmpl b/templates/data-sources/k8s_version.md.tmpl new file mode 100644 index 0000000000..692e1c4446 --- /dev/null +++ b/templates/data-sources/k8s_version.md.tmpl @@ -0,0 +1,46 @@ +--- +subcategory: "Kubernetes" +page_title: "Scaleway: scaleway_k8s_version" +--- + +# scaleway_k8s_version + +Gets information about a Kubernetes version. +For more information, see the [API documentation](https://developers.scaleway.com/en/products/k8s/api). + +You can also use the [scaleway-cli](https://github.com/scaleway/scaleway-cli) with `scw k8s version list` to list all available versions. + +## Example Usage + +### Use the latest version + +```hcl +data "scaleway_k8s_version" "latest" { + name = "latest" +} +``` + +### Use a specific version + +```hcl +data "scaleway_k8s_version" "by_name" { + name = "1.26.0" +} +``` + +## Argument Reference + +- `name` - (Required) The name of the Kubernetes version. +- `region` - (Defaults to [provider](../index.md) `region`) The [region](../guides/regions_and_zones.md#regions) in which the version exists. + +## Attributes Reference + +In addition to all above arguments, the following attributes are exported: + +- `id` - The ID of the version. + +~> **Important:** Kubernetes versions' IDs are [regional](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{region}/{name}`, e.g. `fr-par/1.1.1` + +- `available_cnis` - The list of supported Container Network Interface (CNI) plugins for this version. +- `available_container_runtimes` - The list of supported container runtimes for this version. +- `available_feature_gates` - The list of supported feature gates for this version. diff --git a/templates/data-sources/lb.md.tmpl b/templates/data-sources/lb.md.tmpl new file mode 100644 index 0000000000..5cdc87f903 --- /dev/null +++ b/templates/data-sources/lb.md.tmpl @@ -0,0 +1,48 @@ +--- +subcategory: "Load Balancers" +page_title: "Scaleway: scaleway_lb" +--- + +# scaleway_lb + +Gets information about a Load Balancer. + +For more information, see the [main documentation](https://www.scaleway.com/en/docs/load-balancer/concepts/#load-balancers) or [API documentation](https://www.scaleway.com/en/developers/api/load-balancer/zoned-api/#path-load-balancer-list-load-balancers). + +## Example Usage + +```hcl +# Get info by name +data "scaleway_lb" "by_name" { + name = "foobar" +} + +# Get info by ID +data "scaleway_lb" "by_id" { + lb_id = "11111111-1111-1111-1111-111111111111" +} +``` + +## Argument Reference + +- `name` - (Optional) The Load Balancer name. + +- `ip_id` - (Optional) The Load Balancer IP ID. + +- `project_id` - (Optional) The ID of the Project the Load Balancer is associated with. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +- `id` - The ID of the Load Balancer. + +~> **Important:** Load Balancer IDs are [zoned](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{zone}/{id}`, e.g. `fr-par-1/11111111-1111-1111-1111-111111111111` + +- `ip_address` - The Load Balancer public IP address. + +- `type` - The Load Balancer type. + +- `tags` - The tags associated with the Load Balancer. + +- `zone` - (Defaults to [provider](../index.md#zone) `zone`) The [zone](../guides/regions_and_zones.md#zones) in which the Load Balancer exists. diff --git a/templates/data-sources/lb_acls.md.tmpl b/templates/data-sources/lb_acls.md.tmpl new file mode 100644 index 0000000000..935237a4ec --- /dev/null +++ b/templates/data-sources/lb_acls.md.tmpl @@ -0,0 +1,58 @@ +--- +subcategory: "Load Balancers" +page_title: "Scaleway: scaleway_lb_acls" +--- + +# scaleway_lb_acls + +Gets information about multiple Load Balancer ACLs. + +For more information, see the [main documentation](https://www.scaleway.com/en/docs/load-balancer/reference-content/acls/) or [API reference](https://www.scaleway.com/en/developers/api/load-balancer/zoned-api/#path-acls-get-an-acl). + +## Example Usage + +```hcl +# Find acls that share the same frontend ID +data "scaleway_lb_acls" "byFrontID" { + frontend_id = "${scaleway_lb_frontend.frt01.id}" +} +# Find acls by frontend ID and name +data "scaleway_lb_acls" "byFrontID_and_name" { + frontend_id = "${scaleway_lb_frontend.frt01.id}" + name = "tf-acls-datasource" +} +``` + +## Argument Reference + +- `frontend_id` - (Required) The frontend ID this ACL is attached to. ACLs with a matching frontend ID are listed. + ~> **Important:** LB frontend IDs are [zoned](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{zone}/{id}`, e.g. `fr-par-1/11111111-1111-1111-1111-111111111111` + +- `name` - (Optional) The ACL name to filter for. ACLs with a matching name are listed. + +- `zone` - (Defaults to [provider](../index.md#zone) `zone`) The [zone](../guides/regions_and_zones.md#zones) in which the ACLs exist. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +- `acls` - List of retrieved ACLs + - `id` - The associated ACL ID. + ~> **Important:** LB ACLs' IDs are [zoned](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{zone}/{id}`, e.g. `fr-par-1/11111111-1111-1111-1111-111111111111` + - `created_at` - The date on which the ACL was created (RFC 3339 format). + - `update_at` - The date on which the ACL was last updated (RFC 3339 format). + - `index` - The priority of this ACL in the ordered list. + - `description` - The description of the ACL resource. + - `action` - The action to be undertaken when an ACL filter matches. + - `type` - The action type. + - `redirect` - Redirect parameters when using an ACL with `redirect` action. + - `type` - The redirect type. + - `target` - The URL used in case of a location redirect, or the scheme name that replaces the request's original scheme. + - `code` - The HTTP redirect code to use. + - `match` - The ACL match rule. + - `ip_subnet` - A list of IPs, or CIDR v4/v6 addresses of the session client, to match. + - `http_filter` - The HTTP filter to match. + - `http_filter_value` - The possible values to match for a given HTTP filter. + - `http_filter_option` - A list of possible values for the HTTP filter based on the HTTP header. + - `invert` - The condition will be of type "unless" if invert is set to `true` + - `ips_edge_services` - Defines whether Edge Services IPs should be matched. diff --git a/templates/data-sources/lb_backend.md.tmpl b/templates/data-sources/lb_backend.md.tmpl new file mode 100644 index 0000000000..2123f11342 --- /dev/null +++ b/templates/data-sources/lb_backend.md.tmpl @@ -0,0 +1,55 @@ +--- +subcategory: "Load Balancers" +page_title: "Scaleway: scaleway_lb_backend" +--- + +# scaleway_lb_backend + +Get information about Scaleway Load Balancer backends. + +For more information, see the [main documentation](https://www.scaleway.com/en/docs/load-balancer/reference-content/configuring-backends/) or [API documentation](https://www.scaleway.com/en/developers/api/load-balancer/zoned-api/#path-backends). + +## Example Usage + +```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 +} +``` + +## Arguments Reference + +The following arguments are supported: + +- `backend_id` - (Optional) The backend ID. + - Only one of `name` and `backend_id` should be specified. + +- `name` - (Optional) The name of the backend. + - When using `name` you should specify the `lb-id` + +- `lb_id` - (Required) Load Balancer ID this backend is attached to. + +## Attributes Reference + +See the [Load Balancer backend resource](../resources/lb_backend.md) for details on the returned attributes - they are identical. diff --git a/templates/data-sources/lb_backends.md.tmpl b/templates/data-sources/lb_backends.md.tmpl new file mode 100644 index 0000000000..115adb8bb7 --- /dev/null +++ b/templates/data-sources/lb_backends.md.tmpl @@ -0,0 +1,71 @@ +--- +subcategory: "Load Balancers" +page_title: "Scaleway: scaleway_lb_backends" +--- + +# scaleway_lb_backends + +Gets information about multiple Load Balancer Backends. + +For more information, see the [main documentation](https://www.scaleway.com/en/docs/load-balancer/reference-content/configuring-backends/) or [API documentation](https://www.scaleway.com/en/developers/api/load-balancer/zoned-api/#path-backends). + +## Example Usage + +```hcl +# Find backends that share the same LB ID +data "scaleway_lb_backends" "byLBID" { + lb_id = "${scaleway_lb.lb01.id}" +} +# Find backends by LB ID and name +data "scaleway_lb_backends" "byLBID_and_name" { + lb_id = "${scaleway_lb.lb01.id}" + name = "tf-backend-datasource" +} +``` + +## Argument Reference + +- `lb_id` - (Required) The Load Balancer ID this backend is attached to. Backends with a matching ID are listed. + +- `name` - (Optional) The backend name to filter for. Backends with a matching name are listed. + +- `zone` - (Defaults to [provider](../index.md#zone) `zone`) The [zone](../guides/regions_and_zones.md#zones) in which backends exist. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +- `backends` - List of retrieved backends + - `id` - The associated backend ID. + - `forward_protocol` - Backend protocol. + - `created_at` - The date on which the backend was created (RFC 3339 format). + - `update_at` - The date on which the backend was last updated (RFC 3339 format). + - `forward_port` - User sessions will be forwarded to this backend server port. + - `forward_port_algorithm` - Load balancing algorithm. + - `sticky_sessions` - Enables cookie-based session persistence. + - `sticky_sessions_cookie_name` - Cookie name for sticky sessions. + - `server_ips` - List of backend server IP addresses. + - `proxy_protocol` - The type of PROXY protocol. + - `timeout_server` - Maximum server connection inactivity time. + - `timeout_connect` - Maximum initial server connection establishment time. + - `timeout_tunnel` - Maximum tunnel inactivity time. + - `failover_host` - Scaleway S3 bucket website to be served if all backend servers are down. + - `ssl_bridging` - Enables SSL between Load Balancer and backend servers. + - `ignore_ssl_server_verify` - Specifies whether the Load Balancer should check the backend server’s certificate before initiating a connection. + - `health_check_timeout` - Timeout before a health check request is considered failed. + - `health_check_delay` - Interval between two health check requests. + - `health_check_port` - Port the health check requests will be sent to. + - `health_check_max_retries` - Number of allowed failed health check requests before the backend server is marked as down. + - `health_check_tcp` - This block enables TCP health checks. + - `health_check_http` - This block enables HTTP health checks. + - `uri` - The path of health check requests. + - `method` - The HTTP method to use for health check requests. + - `code` - The expected HTTP status code. + - `host_header` - The HTTP host header to use for health check requests. + - `health_check_https` - This block enables HTTPS health checks. + - `uri` - The path of health check requests. + - `method` - The HTTP method to use for health check requests. + - `code` - The expected HTTP status code. + - `host_header` - The HTTP host header to use for health check requests. + - `sni` - The SNI to use for HC requests over SSL. + - `on_marked_down_action` - Modify what occurs when a backend server is marked down. diff --git a/templates/data-sources/lb_certificate.md.tmpl b/templates/data-sources/lb_certificate.md.tmpl new file mode 100644 index 0000000000..f71b69914b --- /dev/null +++ b/templates/data-sources/lb_certificate.md.tmpl @@ -0,0 +1,60 @@ +--- +subcategory: "Load Balancers" +page_title: "Scaleway: scaleway_lb_certificate" +--- + +# scaleway_lb_certificate + +Get information about Scaleway Load Balancer certificates. + +This data source can prove useful when a module accepts a Load Balancer certificate as an input variable and needs to, for example, determine the security of a certificate for the frontend associated with your domain. + +For more information, see the [main documentation](https://www.scaleway.com/en/docs/load-balancer/how-to/add-certificate/) or [API documentation](https://www.scaleway.com/en/developers/api/load-balancer/zoned-api/#path-certificate). + +## Examples + +### Let's Encrypt + +```hcl +resource "scaleway_lb_ip" "main" { +} + +resource "scaleway_lb" "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}" +} +``` + +## Arguments Reference + +The following arguments are supported: + +- `certificate_id` - (Optional) The certificate ID. + - Only one of `name` and `certificate_id` should be specified. + +- `name` - (Optional) The name of the Load Balancer certificate. + - When using a certificate `name` you should specify the `lb-id` + +- `lb_id` - (Required) The Load Balancer ID this certificate is attached to. + +## Attributes Reference + +See the [Load Balancer certificate resource](../resources/lb_certificate.md) for details on the returned attributes - they are identical. diff --git a/templates/data-sources/lb_frontend.md.tmpl b/templates/data-sources/lb_frontend.md.tmpl new file mode 100644 index 0000000000..7f18bdb401 --- /dev/null +++ b/templates/data-sources/lb_frontend.md.tmpl @@ -0,0 +1,57 @@ +--- +subcategory: "Load Balancers" +page_title: "Scaleway: scaleway_lb_frontend" +--- + +# scaleway_lb_frontend + +Get information about Scaleway Load Balancer frontends. + +For more information, see the [main documentation](https://www.scaleway.com/en/docs/load-balancer/reference-content/configuring-frontends/) or [API documentation](https://www.scaleway.com/en/developers/api/load-balancer/zoned-api/#path-frontends). + +## Example Usage + +```hcl +resource "scaleway_lb_ip" "ip01" {} +resource "scaleway_lb" "lb01" { + ip_id = scaleway_lb_ip.ip01.id + name = "test-lb" + type = "lb-s" +} +resource "scaleway_lb_backend" "bkd01" { + lb_id = scaleway_lb.lb01.id + forward_protocol = "tcp" + forward_port = 80 + proxy_protocol = "none" +} +resource "scaleway_lb_frontend" "frt01" { + lb_id = scaleway_lb.lb01.id + backend_id = scaleway_lb_backend.bkd01.id + inbound_port = 80 +} + +data "scaleway_lb_frontend" "byID" { + frontend_id = scaleway_lb_frontend.frt01.id +} + +data "scaleway_lb_frontend" "byName" { + name = scaleway_lb_frontend.frt01.name + lb_id = scaleway_lb.lb01.id +} +``` + +## Arguments Reference + +The following arguments are supported: + +- `frontend_id` - (Optional) The frontend ID. + - Only one of `name` and `frontend_id` should be specified. + +- `name` - (Optional) The name of the frontend. + - When using the `name` you should specify the `lb-id` + +- `lb_id` - (Required) The Load Balancer ID this frontend is attached to. + +## Attributes Reference + +See the [Load Balancer frontend resource](../resources/lb_frontend.md) for details on the returned attributes - they are identical. diff --git a/templates/data-sources/lb_frontends.md.tmpl b/templates/data-sources/lb_frontends.md.tmpl new file mode 100644 index 0000000000..27798e553e --- /dev/null +++ b/templates/data-sources/lb_frontends.md.tmpl @@ -0,0 +1,50 @@ +--- +subcategory: "Load Balancers" +page_title: "Scaleway: scaleway_lb_frontends" +--- + +# scaleway_lb_frontends + +Gets information about multiple Load Balancer frontends. + +For more information, see the [main documentation](https://www.scaleway.com/en/docs/load-balancer/reference-content/configuring-frontends/) or [API documentation](https://www.scaleway.com/en/developers/api/load-balancer/zoned-api/#path-frontends). + +## Example Usage + +```hcl +# Find frontends that share the same LB ID +data "scaleway_lb_frontends" "byLBID" { + lb_id = "${scaleway_lb.lb01.id}" +} +# Find frontends by LB ID and name +data "scaleway_lb_frontends" "byLBID_and_name" { + lb_id = "${scaleway_lb.lb01.id}" + name = "tf-frontend-datasource" +} +``` + +## Argument Reference + +- `lb_id` - (Required) The Load Balancer ID this frontend is attached to. Frontends with a matching ID are listed. + +- `name` - (Optional) The frontend name to filter for. Frontends with a matching name are listed. + +- `zone` - (Defaults to [provider](../index.md#zone) `zone`) The [zone](../guides/regions_and_zones.md#zones) in which the frontends exist. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +- `frontends` - List of retrieved frontends + - `id` - The ID of the associated frontend. + ~> **Important:** LB frontend IDs are [zoned](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{zone}/{id}`, e.g. `fr-par-1/11111111-1111-1111-1111-111111111111` + - `inbound_port` - TCP port the frontend listens to. + - `created_at` - The date on which the frontend was created (RFC 3339 format). + - `update_at` - The date on which the frontend was last updated (RFC 3339 format). + - `backend_id` - The Load Balancer backend ID this frontend is attached to. + ~> **Important:** Load Balancer backend IDs are [zoned](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{zone}/{id}`, e.g. `fr-par-1/11111111-1111-1111-1111-111111111111` + - `timeout_client` - Maximum inactivity time on the client side. + - `certificate_ids` - List of certificate IDs that are used by the frontend. + - `enable_http3` - Whether HTTP/3 protocol is activated. + - `connection_rate_limit` - The rate limit for new connections established on this frontend. Use 0 value to disable, else value is connections per second. + - `enable_access_logs` - Defines whether to enable access logs on the frontend. diff --git a/templates/data-sources/lb_ip.md.tmpl b/templates/data-sources/lb_ip.md.tmpl new file mode 100644 index 0000000000..e4d02fe608 --- /dev/null +++ b/templates/data-sources/lb_ip.md.tmpl @@ -0,0 +1,55 @@ +--- +subcategory: "Load Balancers" +page_title: "Scaleway: scaleway_lb_ip" +--- + +# scaleway_lb_ip + +Gets information about a Load Balancer IP address. + +For more information, see the [main documentation](https://www.scaleway.com/en/docs/load-balancer/how-to/create-manage-flex-ips/) or [API documentation](https://www.scaleway.com/en/developers/api/load-balancer/zoned-api/#path-ip-addresses-list-ip-addresses). + + +## Example Usage + +```hcl +# Get info by IP address +data "scaleway_lb_ip" "my_ip" { + ip_address = "0.0.0.0" +} + +# Get info by IP ID +data "scaleway_lb_ip" "my_ip" { + ip_id = "11111111-1111-1111-1111-111111111111" +} +``` + +## Argument Reference + +The following arguments are supported: + +- `ip_address` - (Optional) The IP address. + Only one of `ip_address` and `ip_id` should be specified. + +- `ip_id` - (Optional) The IP ID. + Only one of `ip_address` and `ip_id` should be specified. + +- `zone` - (Defaults to [provider](../index.md#zone) `zone`) The [zone](../guides/regions_and_zones.md#zones) in which the IP was reserved. + +- `project_id` - (Optional) The ID of the Project the Load Balancer IP is associated with. + +## Attributes Reference + +In addition to all above arguments, the following attributes are exported: + +- `id` - The ID of the IP. + +~> **Important:** Load Balancers IP IDs are [zoned](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{zone}/{id}`, e.g. `fr-par-1/11111111-1111-1111-1111-111111111111` + +- `reverse` - The reverse domain associated with this IP. + +- `lb_id` - The ID of the associated Load Balancer, if any + +- `tags` - The tags associated with this IP. + +- `organization_id` - (Defaults to [provider](../index.md#organization_id) `organization_id`) The ID of the Organization the Load Balancer IP is associated with. diff --git a/templates/data-sources/lb_ips.md.tmpl b/templates/data-sources/lb_ips.md.tmpl new file mode 100644 index 0000000000..b1a2cea1f3 --- /dev/null +++ b/templates/data-sources/lb_ips.md.tmpl @@ -0,0 +1,53 @@ +--- +subcategory: "Load Balancers" +page_title: "Scaleway: scaleway_lb_ips" +--- + +# scaleway_lb_ips + +Gets information about multiple Load Balancer IP addresses. + +For more information, see the [main documentation](https://www.scaleway.com/en/docs/load-balancer/how-to/create-manage-flex-ips/) or [API documentation](https://www.scaleway.com/en/developers/api/load-balancer/zoned-api/#path-ip-addresses-list-ip-addresses). + +## Example Usage + +```hcl +# Find multiple IPs that share the same CIDR block +data "scaleway_lb_ips" "my_key" { + ip_cidr_range = "0.0.0.0/0" +} +# Find IPs by CIDR block and zone +data "scaleway_lb_ips" "my_key" { + ip_cidr_range = "0.0.0.0/0" + zone = "fr-par-2" +} + +# Find IPs that share the same tags and type +data "scaleway_lb_ips" "ips_by_tags_and_type" { + tags = ["a tag"] + ip_type = "ipv4" +} +``` + +## Argument Reference + +- `ip_cidr_range` - (Optional) The IP CIDR range to filter for. IPs within a matching CIDR block are listed. + +- `tags` - (Optional) List of tags used as filter. IPs with these exact tags are listed. + +- `ip_type` - (Optional) The IP type used as a filter. + +- `zone` - (Defaults to [provider](../index.md#zone) `zone`) The [zone](../guides/regions_and_zones.md#zones) in which the IPs exist. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +- `ips` - List of retrieved IPs + - `id` - The ID of the associated IP. + - `lb_id` - The ID of the associated Load BalancerD, if any + - `ip_address` - The IP address + - `zone` - The [zone](../guides/regions_and_zones.md#zones) of the Load Balancer. + - `reverse` - The reverse domain associated with this IP. + - `organization_id` - The ID of the Organization the Load Balancer is associated with. + - `project_id` - The ID of the Project the Load Balancer is associated with. diff --git a/templates/data-sources/lb_route.md.tmpl b/templates/data-sources/lb_route.md.tmpl new file mode 100644 index 0000000000..7136a0eec6 --- /dev/null +++ b/templates/data-sources/lb_route.md.tmpl @@ -0,0 +1,51 @@ +--- +subcategory: "Load Balancers" +page_title: "Scaleway: scaleway_lb_route" +--- + +# scaleway_lb_route + +Get information about Scaleway Load Balancer routes. + +For more information, see the [main documentation](https://www.scaleway.com/en/docs/load-balancer/how-to/create-manage-routes/) or [API documentation](https://www.scaleway.com/en/developers/api/load-balancer/zoned-api/#path-route). + +## Example Usage + +```hcl +resource "scaleway_lb_ip" "ip01" {} +resource "scaleway_lb" "lb01" { + ip_id = scaleway_lb_ip.ip01.id + name = "test-lb" + type = "lb-s" +} +resource "scaleway_lb_backend" "bkd01" { + lb_id = scaleway_lb.lb01.id + forward_protocol = "tcp" + forward_port = 80 + proxy_protocol = "none" +} +resource "scaleway_lb_frontend" "frt01" { + lb_id = scaleway_lb.lb01.id + backend_id = scaleway_lb_backend.bkd01.id + inbound_port = 80 +} +resource "scaleway_lb_route" "rt01" { + frontend_id = scaleway_lb_frontend.frt01.id + backend_id = scaleway_lb_backend.bkd01.id + match_sni = "sni.scaleway.com" +} + +data "scaleway_lb_route" "byID" { + route_id = scaleway_lb_route.rt01.id +} +``` + +## Argument Reference + +The following argument is supported: + +- `route_id` - (Required) The route ID. + +## Attributes Reference + +See the [Load Balancer route resource](../resources/lb_route.md) for details on the returned attributes - they are identical. diff --git a/templates/data-sources/lb_routes.md.tmpl b/templates/data-sources/lb_routes.md.tmpl new file mode 100644 index 0000000000..6f43cb68e2 --- /dev/null +++ b/templates/data-sources/lb_routes.md.tmpl @@ -0,0 +1,44 @@ +--- +subcategory: "Load Balancers" +page_title: "Scaleway: scaleway_lb_routes" +--- + +# scaleway_lb_routes + +Gets information about multiple Load Balancer routes. + +For more information, see the [main documentation](https://www.scaleway.com/en/docs/load-balancer/how-to/create-manage-routes/) or [API documentation](https://www.scaleway.com/en/developers/api/load-balancer/zoned-api/#path-route). + +## Example Usage + +```hcl +# Find routes that share the same frontend ID +data "scaleway_lb_routes" "by_frontendID" { + frontend_id = scaleway_lb_frontend.frt01.id +} +# Find routes by frontend ID and zone +data "scaleway_lb_routes" "my_key" { + frontend_id = "11111111-1111-1111-1111-111111111111" + zone = "fr-par-2" +} +``` + +## Argument Reference + +- `frontend_id` - (Optional) The frontend ID (the origin of the redirection), to filter for. Routes with a matching frontend ID are listed. + +- `zone` - (Defaults to [provider](../index.md#zone) `zone`) The [zone](../guides/regions_and_zones.md#zones) in which the routes exist. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +- `routes` - List of retrieved routes + - `id` - The associated route ID. + - `backend_id` - The backend ID to redirect to + - `created_at` - The date on which the route was created (RFC 3339 format). + - `update_at` - The date on which the route was last updated (RFC 3339 format). + - `match_subdomains` - If true, all subdomains will match. + - `match_sni` - Server Name Indication TLS extension field from an incoming connection made via an SSL/TLS transport layer. + - `match_host_header` - Specifies the host of the server to which the request is being sent. + - `match_path_begin` - The value to match in the URL beginning path from an incoming request. diff --git a/templates/data-sources/lbs.md.tmpl b/templates/data-sources/lbs.md.tmpl new file mode 100644 index 0000000000..0f3098d7da --- /dev/null +++ b/templates/data-sources/lbs.md.tmpl @@ -0,0 +1,63 @@ +--- +subcategory: "Load Balancers" +page_title: "Scaleway: scaleway_lbs" +--- + +# scaleway_lbs + +Gets information about multiple Load Balancers. + +For more information, see the [main documentation](https://www.scaleway.com/en/docs/load-balancer/concepts/#load-balancers) or [API documentation](https://www.scaleway.com/en/developers/api/load-balancer/zoned-api/#path-load-balancer-list-load-balancers). + +## Example Usage + +```hcl +# Find LBs by name +data "scaleway_lbs" "my_key" { + name = "foobar" +} + +# Find LBs by name and zone +data "scaleway_lbs" "my_key" { + name = "foobar" + zone = "fr-par-2" +} + +# Find LBs that share the same tags +data "scaleway_lbs" "lbs_by_tags" { + tags = ["a tag"] +} +``` + +## Argument Reference + +- `name` - (Optional) The Load Balancer name to filter for. Load Balancers with a matching name are listed. + +- `tags` - (Optional) List of tags to filter for. Load Balancers with these exact tags are listed. + +- `zone` - (Defaults to [provider](../index.md#zone) `zone`) The [zone](../guides/regions_and_zones.md#zones) in which the Load Balancers exist. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +- `lbs` - List of retrieved Load Balancers + - `id` - The ID of the Load Balancer. + - `tags` - The tags associated with the Load Balancer. + - `description` - The description of the Load Balancer. + - `status` - The state of the Load Balancer Instance. Possible values are: `unknown`, `ready`, `pending`, `stopped`, `error`, `locked` and `migrating`. + - `zone` - The [zone](../guides/regions_and_zones.md#zones) of the Load Balancer. + - `name` - The name of the Load Balancer. + - `type` - The offer type of the Load Balancer. + - `instances` - List of underlying Instances. + - `ips` - List of IPs attached to the Load Balancer. + - `frontend_count` - Number of frontends the Load Balancer has. + - `backend_count` - Number of backends the Load Balancer has. + - `private_network_count` - Number of Private Networks attached to the Load balancer. + - `route_count` - Number of routes the Load balancer has. + - `subscriber` - The subscriber information. + - `ssl_compatibility_level` - Determines the minimal SSL version which needs to be supported on the client side. + - `created_at` - Date on which the Load Balancer was created. + - `updated_at` - Date on which the Load Balancer was updated. + - `organization_id` - The ID of the Organization the Load Balancer is associated with. + - `project_id` - The ID of the Project the Load Balancer is associated with. diff --git a/templates/data-sources/marketplace_image.md.tmpl b/templates/data-sources/marketplace_image.md.tmpl new file mode 100644 index 0000000000..a1581fcfee --- /dev/null +++ b/templates/data-sources/marketplace_image.md.tmpl @@ -0,0 +1,36 @@ +--- +subcategory: "Instances" +page_title: "Scaleway: scaleway_marketplace_image" +--- + +# scaleway_marketplace_image + +Gets local image ID of an image from its label name. + +## Example Usage + +```hcl +data "scaleway_marketplace_image" "my_image" { + label = "ubuntu_jammy" +} +``` + +## Argument Reference + +- `label` - (Required) Exact label of the desired image. You can use [this endpoint](https://www.scaleway.com/en/developers/api/marketplace/#path-marketplace-images-list-marketplace-images) +to find the right `label`. + +- `instance_type` - (Optional, default `DEV1-S`) The instance type the image is compatible with. +You find all the available types on the [pricing page](https://www.scaleway.com/en/pricing/). + +- `image_type` - (Optional, default `instance_local`) The local image type, `instance_local` or `instance_sbs`. + +- `zone` - (Defaults to [provider](../index.md#zone) `zone`) The [zone](../guides/regions_and_zones.md#zones) in which the image exists. + +## Attributes Reference + +In addition to all above arguments, the following attributes are exported: + +- `id` - The ID of the local image. + +- ~> **Important:** Instance local images' IDs are [zoned](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{zone}/{id}`, e.g. `fr-par-1/11111111-1111-1111-1111-111111111111` diff --git a/templates/data-sources/mnq_sns.md.tmpl b/templates/data-sources/mnq_sns.md.tmpl new file mode 100644 index 0000000000..99ea8e3141 --- /dev/null +++ b/templates/data-sources/mnq_sns.md.tmpl @@ -0,0 +1,41 @@ +--- +subcategory: "Messaging and Queuing" +page_title: "Scaleway: scaleway_mnq_sns" +--- + +# scaleway_mnq_sns + +Gets information about SNS for a Project + +## Examples + +### Basic + +```hcl +// For default project +data "scaleway_mnq_sns" "main" {} + +// For specific project +data "scaleway_mnq_sns" "for_project" { + project_id = scaleway_account_project.main.id +} +``` + +## Arguments Reference + +The following arguments are supported: + +- `region` - (Defaults to [provider](../index.md#region) `region`). The [region](../guides/regions_and_zones.md#regions) in which sns is enabled. + +- `project_id` - (Defaults to [provider](../index.md#project_id) `project_id`) The ID of the Project in which sns is enabled. + + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +- `id` - The ID of the Project + +~> **Important:** Messaging and Queueing sns' IDs are [regional](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{region}/{id}`, e.g. `fr-par/11111111-1111-1111-1111-111111111111` + +- `endpoint` - The endpoint of the SNS service for this Project. diff --git a/templates/data-sources/mnq_sqs.md.tmpl b/templates/data-sources/mnq_sqs.md.tmpl new file mode 100644 index 0000000000..ff71db31da --- /dev/null +++ b/templates/data-sources/mnq_sqs.md.tmpl @@ -0,0 +1,41 @@ +--- +subcategory: "Messaging and Queuing" +page_title: "Scaleway: scaleway_mnq_sqs" +--- + +# scaleway_mnq_sqs + +Gets information about SQS for a Project + +## Examples + +### Basic + +```hcl +// For default project +data "scaleway_mnq_sqs" "main" {} + +// For specific project +data "scaleway_mnq_sqs" "for_project" { + project_id = scaleway_account_project.main.id +} +``` + +## Arguments Reference + +The following arguments are supported: + +- `region` - (Defaults to [provider](../index.md#region) `region`). The [region](../guides/regions_and_zones.md#regions) in which SQS is enabled. + +- `project_id` - (Defaults to [provider](../index.md#project_id) `project_id`) The ID of the Project in which SQS is enabled. + + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +- `id` - The ID of the Project + +~> **Important:** Messaging and Queueing sqs' IDs are [regional](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{region}/{id}`, e.g. `fr-par/11111111-1111-1111-1111-111111111111` + +- `endpoint` - The endpoint of the SQS service for this Project. diff --git a/templates/data-sources/mongodb_instance.md.tmpl b/templates/data-sources/mongodb_instance.md.tmpl new file mode 100644 index 0000000000..f37427cdc4 --- /dev/null +++ b/templates/data-sources/mongodb_instance.md.tmpl @@ -0,0 +1,68 @@ +--- +subcategory: "MongoDB®" +page_title: "Scaleway: scaleway_mongodb_instance" +--- + +# scaleway_mongodb_instance + +Gets information about a MongoDB® Instance. + +For further information refer to the Managed Databases for MongoDB® [API documentation](https://developers.scaleway.com/en/products/mongodb/api/) + +## Example Usage + +```hcl +# Get info by name +data "scaleway_mongodb_instance" "my_instance" { + name = "foobar" +} + +# Get info by instance ID +data "scaleway_mongodb_instance" "my_instance" { + instance_id = "11111111-1111-1111-1111-111111111111" +} + +# Get other attributes +output "mongodb_version" { + description = "Version of the MongoDB instance" + value = data.scaleway_mongodb_instance.my_instance.version +} +``` + +## Argument Reference + +- `name` - (Optional) The name of the MongoDB® instance. + +- `instance_id` - (Optional) The MongoDB® instance ID. + + -> **Note** You must specify at least one: `name` or `instance_id`. + +- `project_id` - (Optional) The ID of the project the MongoDB® instance is in. Can be used to filter instances when using `name`. + +- `region` - (Defaults to [provider](../index.md#region) `region`) The [region](../guides/regions_and_zones.md#zones) in which the MongoDB® Instance exists. + +- `organization_id` - (Defaults to [provider](../index.md#organization_id) `organization_id`) The ID of the organization the MongoDB® instance is in. + +## Attributes Reference + +In addition to all above arguments, the following attributes are exported: + +- `id` - The ID of the MongoDB® Instance. +- `name` - The name of the MongoDB® instance. +- `version` - The version of MongoDB® running on the instance. +- `node_type` - The type of MongoDB® node. +- `node_number` - The number of nodes in the MongoDB® cluster. +- `created_at` - The date and time the MongoDB® instance was created. +- `project_id` - The ID of the project the instance belongs to. +- `tags` - A list of tags attached to the MongoDB® instance. +- `volume_type` - The type of volume attached to the MongoDB® instance. +- `volume_size_in_gb` - The size of the attached volume, in GB. +- `public_network` - The details of the public network configuration, if applicable. + +## Import + +MongoDB® instance can be imported using the `id`, e.g. + +```bash +terraform import scaleway_mongodb_instance.main fr-par-1/11111111-1111-1111-1111-111111111111 +``` diff --git a/templates/data-sources/object_bucket.md.tmpl b/templates/data-sources/object_bucket.md.tmpl new file mode 100644 index 0000000000..13657b0c93 --- /dev/null +++ b/templates/data-sources/object_bucket.md.tmpl @@ -0,0 +1,61 @@ +--- +subcategory: "Object Storage" +page_title: "Scaleway: scaleway_object_bucket" +--- + +# scaleway_object_bucket + +The `scaleway_object_bucket` data source is used to retrieve information about an Object Storage bucket. + +Refer to the Object Storage [documentation](https://www.scaleway.com/en/docs/object-storage/how-to/create-a-bucket/) for more information. + +## Retrieve an Object Storage bucket + +The following commands allow you to: + +- retrieve a bucket by its name +- retrieve a bucket by its ID + +```hcl +resource "scaleway_object_bucket" "main" { + name = "bucket.test.com" + tags = { + foo = "bar" + } +} + +data "scaleway_object_bucket" "selected" { + name = scaleway_object_bucket.main.id +} +``` + +## Retrieve a bucket from a specific project + +```hcl +data "scaleway_object_bucket" "selected" { + name = "bucket.test.com" + project_id = "11111111-1111-1111-1111-111111111111" +} +``` + +## Argument Reference + +This section lists the arguments that you can provide to the `scaleway_object_bucket` data source to filter and retrieve the desired Object Storage bucket. Each argument has a specific purpose: + +- `name` - (Required) The name of the bucket, or its terraform ID (`{region}/{name}`) +- `object_lock_enabled` - (Optional) Enable object lock on the bucket. Defaults to `false`. Updating this field will force the creation of a new bucket. +- `region` - (Defaults to [provider](../index.md#region) `region`) The [region](../guides/regions_and_zones.md#zones) in which the bucket exists. +- `project_id` - (Defaults to [provider](../index.md#project_id) `project_id`) The ID of the project with which the bucket is associated. + + +## Attributes Reference + +The `scaleway_object_bucket` data source exports certain attributes once the bucket information is retrieved. These attributes can be referenced in other parts of your Terraform configuration. + +In addition to all above arguments, the following attribute is exported: + +* `id` - The unique identifier of the bucket. + +~> **Important:** Object buckets' IDs are [regional](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{region}/{name}`, e.g. `fr-par/bucket-name` + +* `endpoint` - The endpoint URL of the bucket diff --git a/templates/data-sources/object_bucket_policy.md.tmpl b/templates/data-sources/object_bucket_policy.md.tmpl new file mode 100644 index 0000000000..5c2bb063cc --- /dev/null +++ b/templates/data-sources/object_bucket_policy.md.tmpl @@ -0,0 +1,44 @@ +--- +subcategory: "Object Storage" +page_title: "Scaleway: scaleway_object_bucket_policy" +--- + +# scaleway_object_bucket_policy + +The `scaleway_object_bucket_policy` data source is used to retrieve information about the bucket policy of an Object Storage bucket. + +Refer to the Object Storage [documentation](https://www.scaleway.com/en/docs/object-storage/api-cli/bucket-policy/) for more information. + +## Retrieve the bucket policy of a bucket + +The following command allows you to retrieve a bucket policy by its bucket. + +```hcl +data "scaleway_object_bucket_policy" "main" { + bucket = "bucket.test.com" +} +``` + +## Argument Reference + +This section lists the arguments that you can provide to the `scaleway_object_bucket_policy` data source to filter and retrieve the desired bucket policy. Each argument has a specific purpose: + +- `bucket` - (Required) The name of the bucket. +- `region` - (Defaults to [provider](../index.md#arguments-reference) `region`) The [region](../guides/regions_and_zones.md#zones) in which the Object Storage exists. +- `project_id` - (Defaults to [provider](../index.md#arguments-reference) `project_id`) The ID of the project with which the bucket is associated. + +~> **Important:** The `project_id` attribute has a particular behavior with s3 products, because the s3 API is scoped by project. +If you are using a project different from the default one, you have to specify the `project_id` for every child resource of the bucket, +like bucket policies. Otherwise, Terraform will try to create the child resource with the default project ID and you will get a 403 error. + +For more information on Object Storage and Scaleway Projects, refer to the [dedicated documentation](https://www.scaleway.com/en/docs/iam/api-cli/using-api-key-object-storage/). + + +## Attributes Reference + +The `scaleway_object_bucket_policy` data source exports certain attributes once the bucket policy information is retrieved. These attributes can be referenced in other parts of your Terraform configuration. + +In addition to all above arguments, the following attribute is exported: + +* `policy` - The content of the bucket policy in JSON format. + diff --git a/templates/data-sources/rdb_acl.md.tmpl b/templates/data-sources/rdb_acl.md.tmpl new file mode 100644 index 0000000000..9ae1ed28af --- /dev/null +++ b/templates/data-sources/rdb_acl.md.tmpl @@ -0,0 +1,37 @@ +--- +subcategory: "Databases" +page_title: "Scaleway: scaleway_rdb_acl" +--- + +# scaleway_rdb_acl + +Gets information about the Database Instance network Access Control List. + +## Example Usage + +```hcl +# Get the database ACL for the instance id 11111111-1111-1111-1111-111111111111 located in the default region e.g: fr-par +data "scaleway_rdb_acl" "my_acl" { + instance_id = "11111111-1111-1111-1111-111111111111" +} +``` + +## Argument Reference + +- `instance_id` - (Required) The RDB instance ID. +- `region` - (Defaults to [provider](../index.md#region) `region`) The [region](../guides/regions_and_zones.md#regions) in which the Database Instance should be created. + +## Attributes Reference + +In addition to all above arguments, the following attributes are exported: + +- `id` - The ID of the ACL. + +~> **Important:** RDB instances ACLs' IDs are [regional](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{region}/{id}`, e.g. `fr-par/11111111-1111-1111-1111-111111111111` + +- `acl_rules` - A list of ACLs rules (structure is described below) + +The `acl_rules` block supports: + +- `ip` - The ip range to whitelist in [CIDR notation](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation) +- `description` - A simple text describing this rule diff --git a/templates/data-sources/rdb_database.md.tmpl b/templates/data-sources/rdb_database.md.tmpl new file mode 100644 index 0000000000..b219340fc8 --- /dev/null +++ b/templates/data-sources/rdb_database.md.tmpl @@ -0,0 +1,36 @@ +--- +subcategory: "Databases" +page_title: "Scaleway: scaleway_rdb_database" +--- + +# scaleway_rdb_database + +Gets information about a database. + +## Example Usage + +```hcl +# Get the database foobar hosted on instance id 11111111-1111-1111-1111-111111111111 +data "scaleway_rdb_database" "my_db" { + instance_id = "11111111-1111-1111-1111-111111111111" + name = "foobar" +} +``` + +## Argument Reference + +- `instance_id` - (Required) The RDB instance ID. + +- `name` - (Required) The name of the RDB instance. + +## Attributes Reference + +In addition to all above arguments, the following attributes are exported: + +- `id` - The ID of the database. + +~> **Important:** RDB databases' IDs are [regional](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{region}/{instance-id}/{database-name}`, e.g. `fr-par/11111111-1111-1111-1111-111111111111/database` + +- `owner` - The name of the owner of the database. +- `managed` - Whether the database is managed or not. +- `size` - Size of the database (in bytes). diff --git a/templates/data-sources/rdb_database_backup.md.tmpl b/templates/data-sources/rdb_database_backup.md.tmpl new file mode 100644 index 0000000000..e812aa81d3 --- /dev/null +++ b/templates/data-sources/rdb_database_backup.md.tmpl @@ -0,0 +1,47 @@ +--- +subcategory: "Databases" +page_title: "Scaleway: scaleway_rdb_database_backup" +--- + +# scaleway_rdb_database_backup + +Gets information about an RDB backup. + +## Example Usage + +```hcl +data "scaleway_rdb_database_backup" "find_by_name" { + name = "mybackup" +} + +data "scaleway_rdb_database_backup" "find_by_name_and_instance" { + name = "mybackup" + instance_id = "11111111-1111-1111-1111-111111111111" +} + +data "scaleway_rdb_database_backup" "find_by_id" { + backup_id = "11111111-1111-1111-1111-111111111111" +} +``` + +## Argument Reference + +- `instance_id` - (Optional) The Database Instance ID. + +- `backup_id` - (Optional) The backup ID. + +- `name` - (Optional) The name of the RDB instance. + + -> **Note** You must specify at least one: `name` and/or `backup_id`. + +- `region` - (Defaults to [provider](../index.md#region) `region`) The [region](../guides/regions_and_zones.md#regions) in which the Database Backup is associated with. + +- `project_id` - (Optional) The ID of the project the Database Backup is associated with. + +## Attributes Reference + +In addition to all above arguments, the following attributes are exported: + +- `id` - The ID of the backup. + +~> **Important:** RDB databases backups' IDs are [regional](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{region}/{id}`, e.g. `fr-par/11111111-1111-1111-1111-111111111111` diff --git a/templates/data-sources/rdb_instance.md.tmpl b/templates/data-sources/rdb_instance.md.tmpl new file mode 100644 index 0000000000..f3b4dda47c --- /dev/null +++ b/templates/data-sources/rdb_instance.md.tmpl @@ -0,0 +1,54 @@ +--- +subcategory: "Databases" +page_title: "Scaleway: scaleway_rdb_instance" +--- + +# scaleway_rdb_instance + +Gets information about an Database Instance. + +For further information refer the Managed Databases for PostgreSQL and MySQL [API documentation](https://developers.scaleway.com/en/products/rdb/api/#database-instance) + +## Example Usage + +```hcl +# Get info by name +data "scaleway_rdb_instance" "my_instance" { + name = "foobar" +} + +# Get info by instance ID +data "scaleway_rdb_instance" "my_instance" { + instance_id = "11111111-1111-1111-1111-111111111111" +} + +# Get other attributes +output "load_balancer_ip_addr" { + description = "IP address of load balancer" + value = data.scaleway_rdb_instance.my_instance.load_balancer.0.ip +} +``` + +## Argument Reference + +- `name` - (Optional) The name of the RDB instance. + +- `instance_id` - (Optional) The RDB instance ID. + + -> **Note** You must specify at least one: `name` and/or `instance_id`. + +- `project_id` - (Optional) The ID of the project the Database Instance is in. Can be used to filter instances when using `name`. + +- `region` - (Defaults to [provider](../index.md#region) `region`) The [region](../guides/regions_and_zones.md#zones) in which the Database Instance exists. + +- `organization_id` - (Defaults to [provider](../index.md#organization_id) `organization_id`) The ID of the organization the RDB instance is in. + +## Attributes Reference + +In addition to all above arguments, the following attributes are exported: + +- `id` - The ID of the Database Instance. + +~> **Important:** Database Instance IDs are [regional](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{region}/{id}`, e.g. `fr-par/11111111-1111-1111-1111-111111111111` + +Exported attributes are the ones from `scaleway_rdb_instance` [resource](../resources/rdb_instance.md) diff --git a/templates/data-sources/rdb_privilege.md.tmpl b/templates/data-sources/rdb_privilege.md.tmpl new file mode 100644 index 0000000000..d67dc9863a --- /dev/null +++ b/templates/data-sources/rdb_privilege.md.tmpl @@ -0,0 +1,40 @@ +--- +subcategory: "Databases" +page_title: "Scaleway: scaleway_rdb_privilege" +--- + +# scaleway_rdb_privilege + +Gets information about the privileges in a database. + +## Example Usage + +```hcl +# Get the database privilege for the user "my-user" on the database "my-database" hosted on instance id 11111111-1111-1111-1111-111111111111 and on the default region. e.g: fr-par +data "scaleway_rdb_privilege" "main" { + instance_id = "11111111-1111-111111111111" + user_name = "my-user" + database_name = "my-database" +} +``` + +## Argument Reference + +- `instance_id` - (Required) The Database Instance ID. + +- `user_name` - (Required) The user name. + +- `database_name` - (Required) The database name. + +- `region` - (Defaults to [provider](../index.md#region) `region`) The [region](../guides/regions_and_zones.md#regions) in which the resource exists. + +## Attributes Reference + +In addition to all above arguments, the following attributes are exported: + +- `id` - The ID of the user privileges. + +~> **Important:** Database user privilege IDs are [regional](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{region}/{instance-id}/{database}/{user-name}`, e.g. `fr-par/11111111-1111-1111-1111-111111111111/database/user` + +- `permission` - The permission for this user on the database. Possible values are `readonly`, `readwrite`, `all` + , `custom` and `none`. diff --git a/templates/data-sources/redis_cluster.md.tmpl b/templates/data-sources/redis_cluster.md.tmpl new file mode 100644 index 0000000000..9170d5b46a --- /dev/null +++ b/templates/data-sources/redis_cluster.md.tmpl @@ -0,0 +1,62 @@ +--- +subcategory: "Redis" +page_title: "Scaleway: scaleway_redis_instance" +--- + +# scaleway_redis_cluster + +Gets information about a Redis™ cluster. + +For further information refer to the Managed Database for Redis™ [API documentation](https://developers.scaleway.com/en/products/redis/api/v1alpha1/#clusters-a85816). + +## Example Usage + +```hcl +# Get info by name +data "scaleway_redis_cluster" "my_cluster" { + name = "foobar" +} + +# Get info by cluster ID +data "scaleway_redis_cluster" "my_cluster" { + cluster_id = "11111111-1111-1111-1111-111111111111" +} +``` + +## Argument Reference + +- `name` - (Optional) The name of the Redis cluster. + +- `cluster_id` - (Optional) The Redis cluster ID. + + -> **Note** You must specify at least one: `name` and/or `cluster_id`. + +- `zone` - (Default to [provider](../index.md) `region`) The [zone](../guides/regions_and_zones.md#zones) in which the server exists. + +- `project_id` - (Optional) The ID of the project the Redis cluster is associated with. + +## Attributes Reference + +In addition to all above arguments, the following attributes are exported: + +- `id` - The ID of the Redis cluster. +- `version` - Redis's Cluster version (e.g. `6.2.7`). +- `user_name` - The first user of the Redis Cluster. +- `password` - Password of the first user of the Redis Cluster. +- `created_at` - The date and time of creation of the Redis Cluster. +- `updated_at` - The date and time of the last update of the Redis Cluster. +- `cluster_size` - The number of nodes in the Redis Cluster. +- `node_type` - The type of Redis Cluster (e.g. `RED1-M`). +- `public_network` - Public network details. +- `private_network` - List of private networks endpoints of the Redis Cluster. +- `endpoint_id` - The ID of the endpoint. +- `port` - TCP port of the endpoint. +- `ips` - List of IPv4 addresses of the endpoint. +- `tls_enabled` - Whether TLS is enabled or not. +- `acl` - List of acl rules. +- `settings` - Map of settings for redis cluster. +- `certificate` - The PEM of the certificate used by redis, only when `tls_enabled` is true. +- `tags` - The tags associated with the Redis Cluster. + + +~> **Important:** Redis™ cluster IDs are [zoned](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{zone}/{id}`, e.g. `fr-par-1/11111111-1111-1111-1111-111111111111` diff --git a/templates/data-sources/registry_image.md.tmpl b/templates/data-sources/registry_image.md.tmpl new file mode 100644 index 0000000000..6dac7112e1 --- /dev/null +++ b/templates/data-sources/registry_image.md.tmpl @@ -0,0 +1,51 @@ +--- +subcategory: "Container Registry" +page_title: "Scaleway: scaleway_registry_image" +--- + +# scaleway_registry_image + +Gets information about a Container Registry image. + +## Example Usage + +```hcl +# Get info by image name +data "scaleway_registry_image" "my_image" { + name = "my-image-name" +} + +# Get info by image ID +data "scaleway_registry_image" "my_image" { + image_id = "11111111-1111-1111-1111-111111111111" + namespace_id = "11111111-1111-1111-1111-111111111111" # Optional +} +``` + +## Argument Reference + +- `name` - (Optional) The image name. + +- `image_id` - (Optional) The image ID. + + -> **Note** You must specify at least one: `name` and/or `image_id`. + +- `namespace_id` - (Optional) The namespace ID in which the image is. + +- `region` - (Defaults to [provider](../index.md#region) `region`) The [region](../guides/regions_and_zones.md#regions) in which the image exists. + +- `project_id` - (Defaults to [provider](../index.md#project_id) `project_id`) The ID of the project the image is associated with. + +## Attributes Reference + +In addition to all above arguments, the following attributes are exported: + +- `id` - The ID of the registry image. + +~> **Important:** Registry images' IDs are [regional](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{region}/{id}`, e.g. `fr-par/11111111-1111-1111-1111-111111111111` + +- `size` - The size of the registry image. +- `visibility` - The privacy policy of the registry image. +- `tags` - The tags associated with the registry image +- `organization_id` - The organization ID the image is associated with. +- `updated_at` - The date the image of the last update diff --git a/templates/data-sources/registry_image_tag.md.tmpl b/templates/data-sources/registry_image_tag.md.tmpl new file mode 100644 index 0000000000..7611d055ae --- /dev/null +++ b/templates/data-sources/registry_image_tag.md.tmpl @@ -0,0 +1,58 @@ +--- +subcategory: "Container Registry" +page_title: "Scaleway: scaleway_registry_image_tag" +--- + +# scaleway_registry_image_tag + +Gets information about a specific tag of a Container Registry image. + +## Example Usage + +```hcl +# Get info by tag ID +data "scaleway_registry_image_tag" "my_image_tag" { + tag_id = "11111111-1111-1111-1111-111111111111" +} + +# Get info by name and image_id +data "scaleway_registry_image_tag" "my_image_tag" { + name = "my-tag-name" + image_id = "22222222-2222-2222-2222-222222222222" +} + +``` + +## Argument Reference + +- `tag_id` - The ID of the registry image tag. + +- `image_id` - The ID of the registry image. + +- `name` - The name of the registry image tag. + +- `region` - (Defaults to provider region) The region in which the registry image tag exists. + +- `organization_id` - (Defaults to provider organization_id) The ID of the organization the image tag is associated with. + +- `project_id` - (Defaults to provider project_id) The ID of the project the image tag is associated with. + +## Attributes Reference + +In addition to all above arguments, the following attributes are exported: + +- `id` - The ID of the registry image. + +~> **Important:** Registry images' IDs are [regional](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{region}/{id}`, e.g. `fr-par/11111111-1111-1111-1111-111111111111` + +- `status` - The status of the registry image tag. + +- `digest` - Hash of the tag content. Several tags of the same image may have the same digest. + +- `created_at` - The date and time when the registry image tag was created. + +- `updated_at` - The date and time of the last update to the registry image tag. + +- `endpoint` - The endpoint where the registry image tag is accessible. + +- `organization_id` - The organization ID the image tag is associated with. diff --git a/templates/data-sources/registry_namespace.md.tmpl b/templates/data-sources/registry_namespace.md.tmpl new file mode 100644 index 0000000000..f83ba2c1da --- /dev/null +++ b/templates/data-sources/registry_namespace.md.tmpl @@ -0,0 +1,46 @@ +--- +subcategory: "Container Registry" +page_title: "Scaleway: scaleway_registry_namespace" +--- + +# scaleway_registry_namespace + +Gets information about a registry namespace. + +## Example Usage + +```hcl +// Get info by namespace name +data "scaleway_registry_namespace" "my_namespace" { + name = "my-namespace-name" +} + +// Get info by namespace ID +data "scaleway_registry_namespace" "my_namespace" { + namespace_id = "11111111-1111-1111-1111-111111111111" +} +``` + +## Argument Reference + +- `name` - (Optional) The namespace name. + +- `namespace_id` - (Optional) The namespace id. + + -> **Note** You must specify at least one: `name` and/or `image_id`. + +- `region` - (Defaults to [provider](../index.md#region) `region`) The [region](../guides/regions_and_zones.md#regions) in which the namespace exists. + +- `project_id` - (Defaults to [provider](../index.md#project_id) `project_id`) The ID of the project the namespace is associated with. + +## Attributes Reference + +In addition to all above arguments, the following attributes are exported: + +- `id` - The ID of the Registry Namespace. + +~> **Important:** Registry namespaces' IDs are [regional](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{region}/{id}`, e.g. `fr-par/11111111-1111-1111-1111-111111111111` + +- `is_public` - The Namespace Privacy Policy: whether or not the images are public. +- `endpoint` - The endpoint of the Registry Namespace. +- `organization_id` - The organization ID the namespace is associated with. diff --git a/templates/data-sources/secret.md.tmpl b/templates/data-sources/secret.md.tmpl new file mode 100644 index 0000000000..fe56caea3f --- /dev/null +++ b/templates/data-sources/secret.md.tmpl @@ -0,0 +1,64 @@ +--- +subcategory: "Secrets" +page_title: "Scaleway: scaleway_secret" +--- + +# scaleway_secret + +The `scaleway_secret` data source is used to get information about a specific secret in Scaleway's Secret Manager. + +Refer to the Secret Manager [product documentation](https://www.scaleway.com/en/docs/identity-and-access-management/secret-manager/) and [API documentation](https://www.scaleway.com/en/developers/api/secret-manager/) for more information. + +## Example Usage + +### Create a secret and get its information + +The following commands allow you to: + +- create a secret named `foo` with the description `barr` +- retrieve the secret's information using the secret's ID +- retrieve the secret's information using the secret's name + +```hcl +// Create a secret +resource "scaleway_secret" "main" { + name = "foo" + description = "barr" +} + +// Get the secret information specified by the secret ID +data "scaleway_secret" "my_secret" { + secret_id = "11111111-1111-1111-1111-111111111111" +} + +// Get the secret information specified by the secret name +data "scaleway_secret" "by_name" { + name = "your_secret_name" +} +``` + +## Argument Reference + +This section lists the arguments that you can provide to the `scaleway_secret` data source to filter and retrieve the desired secret: + + +- `name` - (Optional) The name of the secret. + Only one of `name` and `secret_id` should be specified. + +- `path` - (Optional) The path of the secret. + Conflicts with `secret_id`. + +- `secret_id` - (Optional) The ID of the secret. + Only one of `name` and `secret_id` should be specified. + +- `organization_id` - (Optional) The ID of the Scaleway Organization the Project is associated with. If no default `organization_id` is set, it must be set explicitly in this data source. + +- `region` - (Defaults to the region specified in the [provider's configuration](../index.md#region)). The [region](../guides/regions_and_zones.md#regions) in which the secret exists. + +- `project_id` - (Optional. Defaults to the Project specified in [provider's configuration](../index.md#project_id)). The ID of the + Project the secret is associated with. + + +## Attributes Reference + +Exported attributes are the ones from the `scaleway_secret` [resource](../resources/secret.md). diff --git a/templates/data-sources/secret_version.md.tmpl b/templates/data-sources/secret_version.md.tmpl new file mode 100644 index 0000000000..e4661beb1a --- /dev/null +++ b/templates/data-sources/secret_version.md.tmpl @@ -0,0 +1,98 @@ +--- +subcategory: "Secrets" +page_title: "Scaleway: scaleway_secret_version" +--- + +# scaleway_secret_version + +The `scaleway_secret_version` data source is used to get information about a specific secret version stored in Scaleway Secret Manager. + +Refer to the Secret Manager [product documentation](https://www.scaleway.com/en/docs/identity-and-access-management/secret-manager/) and [API documentation](https://www.scaleway.com/en/developers/api/secret-manager/) for more information. + + +## Example Usage + +### Use Secret Manager + +The following commands allow you to: + +- create a secret named `fooii` +- create a new version of `fooii` containing data (`your_secret`) +- retrieve the secret version specified by the secret ID and the desired version +- retrieve the secret version specified by the secret name and the desired version + +The output blocks display the sensitive data contained in your secret version. + + +```hcl +# Create a secret named fooii +resource "scaleway_secret" "main" { + name = "fooii" + description = "barr" +} + +# Create a version of fooii containing data +resource "scaleway_secret_version" "main" { + description = "your description" + secret_id = scaleway_secret.main.id + data = "your_secret" +} + +# Retrieve the secret version specified by the secret ID and the desired version +data "scaleway_secret_version" "data_by_secret_id" { + secret_id = scaleway_secret.main.id + revision = "1" + depends_on = [scaleway_secret_version.main] +} + +# Retrieve the secret version specified by the secret name and the desired version +data "scaleway_secret_version" "data_by_secret_name" { + secret_name = scaleway_secret.main.name + revision = "1" + depends_on = [scaleway_secret_version.main] +} + +# Display sensitive data +output "scaleway_secret_access_payload" { + value = data.scaleway_secret_version.data_by_secret_name.data +} + +# Display sensitive data +output "scaleway_secret_access_payload_by_id" { + value = data.scaleway_secret_version.data_by_secret_id.data +} +``` + +## Argument Reference + +This section lists the arguments that you can provide to the `scaleway_secret_version` data source to filter and retrieve the desired version: + +- `secret_id` - (Optional) The ID of the secret associated with the secret version. Only one of `secret_id` and `secret_name` should be specified. + +- `secret_name` - (Optional) The name of the secret associated with the secret version. + Only one of `secret_id` and `secret_name` should be specified. + +- `revision` - The revision for this secret version. Refer to alternative values (ex: `latest`) in the [API documentation](https://www.scaleway.com/en/developers/api/secret-manager/#path-secret-versions-access-a-secrets-version-using-the-secrets-id) + +- `project_id` - (Optional) The ID of the Scaleway Project associated with the secret version. + +## Data information + +Note: This data source provides you with access to the secret payload, which is encoded in base64. + +Keep in mind that this is a sensitive attribute. For more information, +see [Sensitive Data in State](https://developer.hashicorp.com/terraform/language/state/sensitive-data). + +~> **Important:** This property is sensitive and will not be displayed in the Terraform plan, for security reasons. + +## Attributes Reference + +This section lists the attributes that are exported by the `scaleway_secret_version` data source. These attributes can be referenced in other parts of your Terraform configuration: + +- `description` - (Optional) The description of the secret version (e.g. `my-new-description`). +- `data` - The data payload of the secret version. This is a sensitive attribute containing the secret value. Learn more in the [data section](/#data-information). +- `status` - The status of the secret version. +- `created_at` - The date and time of the secret version's creation in RFC 3339 format. +- `updated_at` - The date and time of the secret version's last update in RFC 3339 format. + +Exported attributes are the ones from the `scaleway_secret_version` [resource](../resources/secret_version.md). diff --git a/templates/data-sources/tem_domain.md.tmpl b/templates/data-sources/tem_domain.md.tmpl new file mode 100644 index 0000000000..deaa07f7fa --- /dev/null +++ b/templates/data-sources/tem_domain.md.tmpl @@ -0,0 +1,38 @@ +--- +subcategory: "Transactional Email" +page_title: "Scaleway: scaleway_tem_domain" +--- + +# scaleway_tem_domain + +Gets information about a transactional email domain. + +## Example Usage + +```hcl +// Get info by domain name +data "scaleway_tem_domain" "my_domain" { + name = "example.com" +} + +// Get info by domain ID +data "scaleway_tem_domain" "my_domain" { + domain_id = "11111111-1111-1111-1111-111111111111" +} +``` + +## Argument Reference + +- `name` - (Optional) The domain name. + Only one of `name` and `domain_id` should be specified. + +- `domain_id` - (Optional) The domain id. + Only one of `name` and `domain_id` should be specified. + +- `region` - (Defaults to [provider](../index.md#region) `region`) The [region](../guides/regions_and_zones.md#regions) in which the domain exists. + +- `project_id` - (Defaults to [provider](../index.md#project_id) `project_id`) The ID of the project the domain is associated with. + +## Attributes Reference + +Exported attributes are the ones from `scaleway_tem_domain` [resource](../resources/tem_domain.md) diff --git a/templates/data-sources/tem_offer_subscription.md.tmpl b/templates/data-sources/tem_offer_subscription.md.tmpl new file mode 100644 index 0000000000..6624161324 --- /dev/null +++ b/templates/data-sources/tem_offer_subscription.md.tmpl @@ -0,0 +1,39 @@ +--- +subcategory: "Transactional Email" +page_title: "Scaleway: scaleway_tem_offer_subscription" +--- + +# scaleway_tem_offer_subscription + +Gets information about a transactional email offer subscription. + +## Example Usage + +```hcl +// Retrieve offer subscription information +data "scaleway_tem_offer_subscription" "test" {} +``` + +## Argument Reference + +- `region` - (Defaults to [provider](../index.md#region) `region`) The [region](../guides/regions_and_zones.md#regions) where the offer subscription exists. +- `project_id` - (Defaults to [provider](../index.md#project_id) `project_id`) The ID of the project the offer subscription is associated with. + +## Attributes Reference + +The following attributes are exported: + +- `offer_name` - The name of the offer associated with the subscription (e.g., `scale`). +- `subscribed_at` - The date and time of the subscription. +- `cancellation_available_at` - The date and time when cancellation becomes available for the subscription. +- `sla` - The Service Level Agreement (SLA) percentage of the offer subscription. +- `max_domains` - The maximum number of domains that can be associated with the offer subscription. +- `max_dedicated_ips` - The maximum number of dedicated IPs that can be associated with the offer subscription. +- `max_webhooks_per_domain` - The maximum number of webhooks that can be associated with the offer subscription per domain. +- `max_custom_blocklists_per_domain` - The maximum number of custom blocklists that can be associated with the offer subscription per domain. +- `included_monthly_emails` - The number of emails included in the offer subscription per month. + +## Import + +This data source is read-only and cannot be imported. + diff --git a/templates/data-sources/vpc.md.tmpl b/templates/data-sources/vpc.md.tmpl new file mode 100644 index 0000000000..2b2a6a14d5 --- /dev/null +++ b/templates/data-sources/vpc.md.tmpl @@ -0,0 +1,40 @@ +--- +subcategory: "VPC" +page_title: "Scaleway: scaleway_vpc" +--- + +# scaleway_vpc + +Gets information about a Scaleway Virtual Private Cloud. + +## Example Usage + +```hcl +# Get info by name +data "scaleway_vpc" "by_name" { + name = "foobar" +} + +# Get info by ID +data "scaleway_vpc" "by_id" { + vpc_id = "11111111-1111-1111-1111-111111111111" +} + +# Get default VPC info +data "scaleway_vpc" "default" { + is_default = true +} +``` + +## Argument Reference + +* `name` - (Optional) Name of the VPC. A maximum of one of `name` and `vpc_id` should be specified. +* `vpc_id` - (Optional) ID of the VPC. A maximum of one of `name` and `vpc_id` should be specified. +* `is_default` - (Optional) Whether the targeted VPC is the default VPC. +* `organization_id` - The ID of the Organization the VPC is associated with. +* `project_id` - (Optional. Defaults to [provider](../index.md#project_id) `project_id`) The ID of the Project the VPC is associated with. + +## Attributes Reference + +Exported attributes are the ones from `scaleway_vpc` [resource](../resources/vpc.md) + diff --git a/templates/data-sources/vpc_gateway_network.md.tmpl b/templates/data-sources/vpc_gateway_network.md.tmpl new file mode 100644 index 0000000000..61b253e14e --- /dev/null +++ b/templates/data-sources/vpc_gateway_network.md.tmpl @@ -0,0 +1,44 @@ +--- +subcategory: "VPC" +page_title: "Scaleway: scaleway_vpc_gateway_network" +--- + +# scaleway_vpc_gateway_network + +Gets information about a GatewayNetwork (a connection between a Public Gateway and a Private Network). + +## Example Usage + +```hcl +resource "scaleway_vpc_gateway_network" "main" { + 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 +} + +data "scaleway_vpc_gateway_network" "by_id" { + gateway_network_id = scaleway_vpc_gateway_network.main.id +} + +data "scaleway_vpc_gateway_network" "by_gateway_and_pn" { + gateway_id = scaleway_vpc_public_gateway.pg01.id + private_network_id = scaleway_vpc_private_network.pn01.id +} +``` + +## Argument Reference + +* `gateway_network_id` - (Optional) ID of the GatewayNetwork. + +~> Only one of `gateway_network_id` or usage of the following filters should be specified. If using filters, you can use as many as you want. + +* `gateway_id` - (Optional) ID of the Public Gateway the GatewayNetwork is linked to +* `private_network_id` - (Optional) ID of the Private Network the GatewayNetwork is linked to +* `enable_masquerade` - (Optional) Whether masquerade (dynamic NAT) is enabled on requested GatewayNetwork +* `dhcp_id` - (Deprecated) ID of the Public Gateway's DHCP configuration + +## Attributes Reference + +Exported attributes are the attributes of the [resource](../resources/vpc_gateway_network.md) diff --git a/templates/data-sources/vpc_private_network.md.tmpl b/templates/data-sources/vpc_private_network.md.tmpl new file mode 100644 index 0000000000..e263921122 --- /dev/null +++ b/templates/data-sources/vpc_private_network.md.tmpl @@ -0,0 +1,45 @@ +--- +subcategory: "VPC" +page_title: "Scaleway: scaleway_vpc_private_network" +--- + +# scaleway_vpc_private_network + +Gets information about a Private Network. + +## Example Usage + +```hcl +# Get info by name +data "scaleway_vpc_private_network" "my_name" { + name = "foobar" +} + +# Get info by name and VPC ID +data "scaleway_vpc_private_network" "my_name_and_vpc_id" { + name = "foobar" + vpc_id = "11111111-1111-1111-1111-111111111111" +} + +# Get info by IP ID +data "scaleway_vpc_private_network" "my_id" { + private_network_id = "11111111-1111-1111-1111-111111111111" +} +``` + +## Argument Reference + +- `name` - (Optional) Name of the Private Network. Cannot be used with `private_network_id`. +- `vpc_id` - (Optional) ID of the VPC the Private Network is in. Cannot be used with `private_network_id`. +- `private_network_id` - (Optional) ID of the Private Network. Cannot be used with `name` or `vpc_id`. +- `project_id` - (Optional) The ID of the Project the Private Network is associated with. + +## Attributes Reference + +In addition to all above arguments, the following attributes are exported: + +- `id` - The ID of the Private Network. +- `ipv4_subnet` - The IPv4 subnet associated with the Private Network. +- `ipv6_subnets` - The IPv6 subnets associated with the Private Network. + +~> **Important:** Private Networks are [regional](../guides/regions_and_zones.md#resource-ids), which means their IDs are of the form `{region}/{id}`, e.g. `fr-par/11111111-1111-1111-1111-111111111111` diff --git a/templates/data-sources/vpc_public_gateway.md.tmpl b/templates/data-sources/vpc_public_gateway.md.tmpl new file mode 100644 index 0000000000..1f3924ad61 --- /dev/null +++ b/templates/data-sources/vpc_public_gateway.md.tmpl @@ -0,0 +1,41 @@ +--- +subcategory: "VPC" +page_title: "Scaleway: scaleway_vpc_public_gateway" +--- + +# scaleway_vpc_public_gateway + +Gets information about a Public Gateway. + +## Example Usage + +```hcl +resource "scaleway_vpc_public_gateway" "main" { + name = "demo" + type = "VPC-GW-S" + zone = "nl-ams-1" +} + +data "scaleway_vpc_public_gateway" "pg_test_by_name" { + name = "${scaleway_vpc_public_gateway.main.name}" + zone = "nl-ams-1" +} + +data "scaleway_vpc_public_gateway" "pg_test_by_id" { + public_gateway_id = "${scaleway_vpc_public_gateway.main.id}" +} +``` + +## Argument Reference + +- `name` - (Required) Exact name of the Public Gateway. +- `zone` - (Defaults to [provider](../index.md#zone) `zone`) The Public Gateway's [zone](../guides/regions_and_zones.md#zones). +- `project_id` - (Optional) The ID of the Project the Public Gateway is associated with. + +## Attributes Reference + +In addition to all above arguments, the following attributes are exported: + +- `id` - The ID of the Public Gateway. + +~> **Important:** Public Gateway IDs are [zoned](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{zone}/{id}`, e.g. `fr-par-1/11111111-1111-1111-1111-111111111111` diff --git a/templates/data-sources/vpc_public_gateway_dhcp.md.tmpl b/templates/data-sources/vpc_public_gateway_dhcp.md.tmpl new file mode 100644 index 0000000000..1ae9470367 --- /dev/null +++ b/templates/data-sources/vpc_public_gateway_dhcp.md.tmpl @@ -0,0 +1,36 @@ +--- +subcategory: "VPC" +page_title: "Scaleway: scaleway_vpc_public_gateway_dhcp" +--- + +# scaleway_vpc_public_gateway_dhcp + +~> **Important:** The data source `scaleway_vpc_public_gateway_dhcp` has been deprecated and will no longer be supported. +In 2023, DHCP functionality was moved from Public Gateways to Private Networks, DHCP resources are now no longer needed. +For more information, please refer to the [dedicated guide](../guides/migration_guide_vpcgw_v2.md). + +Gets information about a Public Gateway DHCP configuration. + +## Example Usage + +```hcl +resource "scaleway_vpc_public_gateway_dhcp" "main" { + subnet = "192.168.0.0/24" +} + +data "scaleway_vpc_public_gateway_dhcp" "dhcp_by_id" { + dhcp_id = "${scaleway_vpc_public_gateway_dhcp.main.id}" +} +``` + +## Argument Reference + + +## Attributes Reference + +In addition to all above arguments, the following attributes are exported: + +- `id` - The ID of the Public Gateway DHCP configuration. + +~> **Important:** Public Gateway DHCP configuration IDs are [zoned](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{zone}/{id}`, e.g. `fr-par-1/11111111-1111-1111-1111-111111111111` + diff --git a/templates/data-sources/vpc_public_gateway_dhcp_reservation.md.tmpl b/templates/data-sources/vpc_public_gateway_dhcp_reservation.md.tmpl new file mode 100644 index 0000000000..67b869b756 --- /dev/null +++ b/templates/data-sources/vpc_public_gateway_dhcp_reservation.md.tmpl @@ -0,0 +1,142 @@ +--- +subcategory: "VPC" +page_title: "Scaleway: scaleway_vpc_public_gateway_dhcp_reservation" +--- + +# scaleway_vpc_public_gateway_dhcp_reservation + +~> **Important:** The data source `scaleway_vpc_public_gateway_dhcp_reservation` has been deprecated and will no longer be supported. +In 2023, DHCP functionality was moved from Public Gateways to Private Networks, DHCP resources are now no longer needed. +You can use IPAM to manage your IPs. For more information, please refer to the [dedicated guide](../guides/migration_guide_vpcgw_v2.md). + +Gets information about a DHCP entry. For further information, please see the +[API documentation](https://www.scaleway.com/en/developers/api/public-gateway/#path-dhcp-entries-list-dhcp-entries). + +## Example Dynamic + +```terraform +resource "scaleway_vpc_private_network" "main" { +} + +resource "scaleway_instance_server" "main" { + image = "ubuntu_jammy" + type = "DEV1-S" + zone = "fr-par-1" +} + +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 +} + +## Retrieve the dynamic entries generated by mac address & gateway network +data "scaleway_vpc_public_gateway_dhcp_reservation" "by_mac_address_and_gw_network" { + mac_address = scaleway_instance_private_nic.main.mac_address + gateway_network_id = scaleway_vpc_gateway_network.main.id +} +``` + +## Example Static and PAT Rule + +```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 +} +``` + +## Argument Reference + +- `reservation_id` (Optional) The ID of the reservation (DHCP entry) to retrieve. +- `mac_address` (Optional) The MAC address of the reservation to retrieve. +- `gateway_network_id` (Optional) The ID of the owning GatewayNetwork. + +~> Only one of `reservation_id` or `mac_address` with `gateway_network_id` should be specified. + +- `wait_for_dhcp` (Optional) Whether to wait for `mac_address` to exist in DHCP. +- `zone` - (Defaults to [provider](../index.md#zone) `zone`). The [zone](../guides/regions_and_zones.md#zones) in which the reservation exists. + +## Attributes Reference + +Exported attributes are those of the `scaleway_vpc_public_gateway_dhcp_reservation` [resource](../resources/vpc_public_gateway_dhcp_reservation.md) diff --git a/templates/data-sources/vpc_public_gateway_ip.md.tmpl b/templates/data-sources/vpc_public_gateway_ip.md.tmpl new file mode 100644 index 0000000000..99030325a8 --- /dev/null +++ b/templates/data-sources/vpc_public_gateway_ip.md.tmpl @@ -0,0 +1,31 @@ +--- +subcategory: "VPC" +page_title: "Scaleway: scaleway_vpc_public_gateway_ip" +--- + +# scaleway_vpc_public_gateway_ip + +Gets information about a Public Gateway public flexible IP address. + +For further information, please see the [API documentation](https://www.scaleway.com/en/developers/api/public-gateway/#path-ips-list-ips). + +## Example Usage + +```hcl +resource "scaleway_vpc_public_gateway_ip" "main" { +} + +data "scaleway_vpc_public_gateway_ip" "ip_by_id" { + ip_id = "${scaleway_vpc_public_gateway_ip.main.id}" +} +``` + +## Argument Reference + +## Attributes Reference + +In addition to all above arguments, the following attributes are exported: + +- `id` - The ID of the Public Gateway IP. + +~> **Important:** Public gateway IP IDs are [zoned](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{zone}/{id}`, e.g. `fr-par-1/11111111-1111-1111-1111-111111111111` diff --git a/templates/data-sources/vpc_public_gateway_pat_rule.md.tmpl b/templates/data-sources/vpc_public_gateway_pat_rule.md.tmpl new file mode 100644 index 0000000000..f702e19cee --- /dev/null +++ b/templates/data-sources/vpc_public_gateway_pat_rule.md.tmpl @@ -0,0 +1,98 @@ +--- +subcategory: "VPC" +page_title: "Scaleway: scaleway_vpc_public_gateway_pat_rule" +--- + +# scaleway_vpc_public_gateway_pat_rule + +Gets information about a Public Gateway PAT rule. For further information, please see the +[API documentation](https://www.scaleway.com/en/developers/api/public-gateway/#path-pat-rules-list-pat-rules). + +## Example Usage + +```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 +} +``` + +## Argument Reference + +- `pat_rule_id` (Required) The ID of the PAT rule to retrieve +- `zone` - (Defaults to [provider](../index.md#zone) `zone`) The [zone](../guides/regions_and_zones.md#zones) in which + the rule exists. + +## Attributes Reference + +`id` is set to the ID of the retrieved Public Gateway PAT rule. + +~> **Important:** Public Gateway PAT rule IDs are [zoned](../guides/regions_and_zones.md#resource-ids), 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`. diff --git a/templates/data-sources/vpc_routes.md.tmpl b/templates/data-sources/vpc_routes.md.tmpl new file mode 100644 index 0000000000..691633e724 --- /dev/null +++ b/templates/data-sources/vpc_routes.md.tmpl @@ -0,0 +1,79 @@ +--- +subcategory: "VPC" +page_title: "Scaleway: scaleway_vpc_routes" +--- + +# scaleway_vpc_routes + +Gets information about multiple VPC routes. + +## Example Usage + +```hcl +resource "scaleway_vpc" "vpc01" { + name = "tf-vpc-route" + enable_routing = true +} + +resource "scaleway_vpc_private_network" "pn01" { + name = "tf-pn-route" + vpc_id = scaleway_vpc.vpc01.id +} + +resource "scaleway_vpc_private_network" "pn02" { + name = "tf-pn_route-2" + vpc_id = scaleway_vpc.vpc01.id +} + +# Find routes with a matching VPC ID +data "scaleway_vpc_routes" "routes_by_vpc_id" { + vpc_id = scaleway_vpc.vpc01.id +} + +# Find routes with a matching next hop private network ID +data "scaleway_vpc_routes" "routes_by_pn_id" { + vpc_id = scaleway_vpc.vpc01.id + nexthop_private_network_id = scaleway_vpc_private_network.pn01.id +} + +# Find routes with an IPv6 destination +data "scaleway_vpc_routes" "routes_by_pn_id" { + vpc_id = scaleway_vpc.vpc01.id + is_ipv6 = true +} + +# Find routes with a nexthop resource type +data "scaleway_vpc_routes" "routes_by_pn_id" { + vpc_id = scaleway_vpc.vpc01.id + nexthop_resource_type = "vpc_gateway_network" +} +``` + +## Argument Reference + +- `vpc_id` - (Optional) The VPC ID to filter for. routes with a similar VPC ID are listed. + +- `nexthop_resource_id` - (Optional) The next hop resource ID to filter for. routes with a similar next hop resource ID are listed. + +- `nexthop_private_network_id` - (Optional) The next hop private network ID to filter for. routes with a similar next hop private network ID are listed. + +- `nexthop_resource_type` - (Optional) The next hop resource type to filter for. routes with a similar next hop resource type are listed. + +- `is_ipv6` - (Optional) Routes with an IPv6 destination will be listed. + +- `tags` - (Optional) List of tags to filter for. routes with these exact tags are listed. + +- `region` - (Defaults to [provider](../index.md#region) `region`). The [region](../guides/regions_and_zones.md#regions) in which the routes exist. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +- `routes` - List of retrieved routes + - `id` - The ID of the route. + ~> **Important:** route IDs are [regional](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{region}/{id}`, e.g. `fr-par/11111111-1111-1111-1111-111111111111 + - `created_at` - The date on which the route was created (RFC 3339 format). + - `destination` - The destination IP or IP range of the route. + - `description` - The description of the route. + - `nexthop_ip` - The IP of the route's next hop. + - `nexthop_name` - The name of the route's next hop. diff --git a/templates/data-sources/vpcs.md.tmpl b/templates/data-sources/vpcs.md.tmpl new file mode 100644 index 0000000000..5c0818c5ed --- /dev/null +++ b/templates/data-sources/vpcs.md.tmpl @@ -0,0 +1,46 @@ +--- +subcategory: "VPC" +page_title: "Scaleway: scaleway_vpcs" +--- + +# scaleway_vpcs + +Gets information about multiple Virtual Private Clouds. + +## Example Usage + +```hcl +# Find VPCs that share the same tags +data "scaleway_vpcs" "my_key" { + tags = ["tag"] +} + +# Find VPCs by name and region +data "scaleway_vpcs" "my_key" { + name = "tf-vpc-datasource" + region = "nl-ams" +} +``` + +## Argument Reference + +- `name` - (Optional) The VPC name to filter for. VPCs with a similar name are listed. + +- `tags` - (Optional) List of tags to filter for. VPCs with these exact tags are listed. + +- `region` - (Defaults to [provider](../index.md#region) `region`). The [region](../guides/regions_and_zones.md#regions) in which the VPCs exist. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +- `vpcs` - List of retrieved VPCs + - `id` - The associated VPC ID. + ~> **Important:** VPC IDs are [regional](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{region}/{id}`, e.g. `fr-par/11111111-1111-1111-1111-111111111111 + - `is_default` - Defines whether the VPC is the default one for its Project. + - `created_at` - Date and time of VPC's creation (RFC 3339 format). + - `updated_at` - Date and time of VPC's last update (RFC 3339 format). + - `organization_id` - The Organization ID the VPC is associated with. + - `project_id` - The ID of the Project the VPC is associated with. + - `enable_routing` - Defines whether routing between Private Networks in the VPC is enabled. + - `enable_custom_routes_propagation` - Defines whether the VPC advertises custom routes between its Private Networks. diff --git a/templates/data-sources/webhosting.md.tmpl b/templates/data-sources/webhosting.md.tmpl new file mode 100644 index 0000000000..148cf3335c --- /dev/null +++ b/templates/data-sources/webhosting.md.tmpl @@ -0,0 +1,34 @@ +--- +subcategory: "Web Hosting" +page_title: "Scaleway: scaleway_webhosting" +--- + +# scaleway_webhosting + +Gets information about a webhosting. + +## Example Usage + +```hcl +# Get info by offer domain +data "scaleway_webhosting" "by_domain" { + domain = "foobar.com" +} + +# Get info by id +data "scaleway_webhosting" "by_id" { + webhosting_id = "11111111-1111-1111-1111-111111111111" +} +``` + +## Argument Reference + +* `domain` - (Optional) The hosting domain name. Only one of `domain` and `webhosting_id` should be specified. +* `webhosting_id` - (Optional) The hosting id. Only one of `domain` and `webhosting_id` should be specified. +* `organization_id` - The ID of the organization the hosting is associated with. +* `project_id` - (Optional. Defaults to [provider](../index.md#project_id) `project_id`) The ID of the project the hosting is associated with. +* `region` - (Defaults to [provider](../index.md#zone) `region`) The [region](../guides/regions_and_zones.md#zones) in which hosting exists. + +## Attributes Reference + +Exported attributes are the ones from `scaleway_webhosting` [resource](../resources/webhosting.md) diff --git a/templates/data-sources/webhosting_offer.md.tmpl b/templates/data-sources/webhosting_offer.md.tmpl new file mode 100644 index 0000000000..da913c9268 --- /dev/null +++ b/templates/data-sources/webhosting_offer.md.tmpl @@ -0,0 +1,68 @@ +--- +subcategory: "Web Hosting" +page_title: "Scaleway: scaleway_webhosting_offer" +--- + +# scaleway_webhosting_offer + +Gets information about a webhosting offer. + +## Example Usage + +```hcl +# Get info by offer name +data "scaleway_webhosting_offer" "by_name" { + name = "performance" + control_panel = "Cpanel" +} + +# Get info by offer id +data "scaleway_webhosting_offer" "by_id" { + offer_id = "de2426b4-a9e9-11ec-b909-0242ac120002" +} +``` + +## Argument Reference + +- `name` - (Optional) The offer name. Only one of `name` and `offer_id` should be specified. + +- `control_panel` - (Optional) Name of the control panel (Cpanel or Plesk). This argument is only used when `offer_id` is not specified. + +- `offer_id` - (Optional) The offer id. Only one of `name` and `offer_id` should be specified. + +- `region` - (Defaults to [provider](../index.md#zone) `region`) The [region](../guides/regions_and_zones.md#zones) in which offer exists. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +- `billing_operation_path` - The unique identifier used for billing. +- `product` - (deprecated) The offer product. + - `option` - The product option. + - `email_accounts_quota` - The quota of email accounts. + - `email_storage_quota` - The quota of email storage. + - `databases_quota` - The quota of databases. + - `hosting_storage_quota` - The quota of hosting storage. + - `support_included` - If support is included. + - `v_cpu` - The number of cores. + - `ram` - The capacity of the memory in GB. +- `offer` - The detailed offer of the hosting. + - `id` - The unique identifier of the offer. + - `name` - The name of the offer. + - `billing_operation_path` - The billing operation identifier for the offer. + - `available` - Indicates if the offer is available. + - `control_panel_name` - The name of the control panel (e.g., Cpanel or Plesk). + - `end_of_life` - Indicates if the offer is deprecated or no longer supported. + - `quota_warning` - Warning information regarding quota limitations. + - `price` - The price of the offer. + - `options` - A list of available options for the offer: + - `id` - The unique identifier of the option. + - `name` - The name of the option. + - `billing_operation_path` - The billing operation identifier for the option. + - `min_value` - The minimum value for the option. + - `current_value` - The current value set for the option. + - `max_value` - The maximum allowed value for the option. + - `quota_warning` - Warning information regarding quota limitations for the option. + - `price` - The price of the option. +- `price` - The offer price. + diff --git a/templates/guides/backend_guide.md b/templates/guides/backend_guide.md new file mode 100644 index 0000000000..9fef3f0902 --- /dev/null +++ b/templates/guides/backend_guide.md @@ -0,0 +1,245 @@ +--- +page_title: "Using Backend Guide" +--- +# Configuring Terraform Backends: PostgreSQL vs Object Storage + +## Configuring a Terraform Backend with PostgreSQL and State Locking + +This guide explains how to configure a remote backend using the Terraform Scaleway Provider with PostgreSQL, enabling remote state management with locking. + +Terraform provides the option to set up a [“backend”](https://developer.hashicorp.com/terraform/language/backend) of the `state` data files. + +This option allows you to handle the state and the way certain operations are executed. + +Backends can store the state remotely and protect it with locks to prevent corruption; +it makes it possible for a team to work with ease, or, for instance, to run Terraform within a pipeline. + +### Create your database + +You can create your database resource using terraform itself . + +If you have already one database running you can step over to [Configuring your Connection string](#configuring-the-postgresql-connection-string) + +```hcl +terraform { + required_providers { + scaleway = { + source = "scaleway/scaleway" + version = "~> 2.2.8" + } + } +} + +provider "scaleway" { + # ... +} + +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# CREATE AN DATABASE INSTANCE TO USE IT AS A TERRAFORM BACKEND +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +resource "scaleway_rdb_database" "database" { + name = "your-database" + instance_id = scaleway_rdb_instance.main.id +} + +resource scaleway_rdb_instance main { + name = "your-backend-db" + node_type = "db-dev-s" + engine = "PostgreSQL-11" + is_ha_cluster = false + disable_backup = true + user_name = "my_initial_user" + password = "thiZ_is_v&ry_s3cret" + tags = ["terraform-backend1"] +} +``` + +and deploy it: + +```shell +terraform plan -out "planfile" ; terraform apply -input=false -auto-approve "planfile" +``` + +#### Configuring the PostgreSQL Connection String + +We choose to set our environment variable for the connection string for this guide. Please check the [secret section](#secrets) for more details. + +```shell +export PG_CONN_STR=postgres://:@localhost:/terraform_backend?sslmode=disable +``` + +#### Secrets + +Hashicorp offers several methods to keep your secrets. Please check the Terraform [partial configuration](https://developer.hashicorp.com/terraform/language/backend#partial-configuration) for this topic. + +#### Create your infrastructure with the Scaleway provider + +```hcl +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# CREATE AN BACKEND TYPE PG +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +terraform { + backend "pg" { + # Please use a better approach with the flag -backend-config=PATH or a Vault configuration + conn_str = "postgres://user:pass@db.example.com/terraform_backend" + } +} + +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# CREATE YOUR INFRASTRUCTURE +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +resource "scaleway_instance_server" "main" { + name = "my-instance" + type = "DEV1-S" + image = "debian_bullseye" + enable_ipv6 = false +} + +# the rest of your configuration and resources to deploy +``` + +Check your database `schema`. e.g: + +```sql +rdb=> SELECT * FROM pg_catalog.pg_tables WHERE schemaname != 'pg_catalog' AND schemaname != 'information_schema'; + schemaname | tablename | tableowner | tablespace | hasindexes | hasrules | hastriggers | rowsecurity +------------------------+-----------+------------+------------+------------+----------+-------------+------------- + terraform_remote_state | states | my_initial_user | | t | f | f | f +``` + +After running terraform `apply`, to terraform.tfstate on the database will look something like this: + +```text +rdb=> SELECT * FROM information_schema.columns +WHERE table_schema = 'terraform_remote_state' +AND TABLE_NAME = 'states'; + id | name | data +----+---------+---------------------------------------------------------- + 1 | default | { + + | | "version": 4, + + | | "serial": 0, + + | | "lineage": "07a1e05b-3cba-438a-0c70-3ec5e73d4baf", + + | | "outputs": {}, + + | | "resources": [ + + | | { + + .... +``` + +### Multiple Workplaces + +You can configure several `states` on your database using a different `schema_name`. + +Then workspaces are appended to that key to generate a separate state for each workspace. +Since tracking of the workspaces is in the table inside PostgreSQL, we need to separate the different states we want to track. + +We can do that in one of two ways: separate databases or separate schemas. + +```hcl +terraform { + # Omitted + + backend "pg" { + schema_name = "other_state" + } +} +``` + +### Migrating the state + +Considering you have already running infrastructure you want to use the `backend` option. + +All we need to do is initialize Terraform passing the backend configuration. + +Terraform should ask if you want to migrate from local to the new remote backend. + +Answer the prompt `yes`, and your state will migrate. + +```shell +$ terraform init -backend-config="conn_str=${PG_CONN_STR}" -migrate-state +``` + +### What about locking? + +Most of the remote [backends](https://developer.hashicorp.com/terraform/language/backend#backend-types) natively support locking. To run terraform apply, Terraform will automatically acquire a lock; +if someone else is already running apply, they will already have the lock, and you will have to wait. +You can run apply with the `-lock-timeout=