Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(edge_services): add resources #2637

Draft
wants to merge 15 commits into
base: master
Choose a base branch
from
58 changes: 58 additions & 0 deletions docs/resources/edge_services_backend_stage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
subcategory: "Edge Services"
page_title: "Scaleway: scaleway_edge_services_backend_stage"
---

# Resource: scaleway_edge_services_backend_stage

Creates and manages Scaleway Edge Services Backend Stages.

## Example Usage

### Basic

```terraform
resource "scaleway_object_bucket" "main" {
name = "my-bucket-name"
tags = {
foo = "bar"
}
}

resource "scaleway_edge_services_backend_stage" "main" {
s3_backend_config {
bucket_name = scaleway_object_bucket.main.name
bucket_region = "fr-par"
}
}
```

### Custom Certificate

```terraform
```

## Argument Reference

- `s3_backend_config` - (Required) The Scaleway Object Storage origin bucket (S3) linked to the backend stage.
- `bucket_name` - The name of the Bucket.
- `bucket_region` - The region of the Bucket.
- `is_website` - Defines whether the bucket website feature is enabled.
- `project_id` - (Defaults to [provider](../index.md#project_id) `project_id`) The ID of the project the backend stage is associated with.

## Attributes Reference

In addition to all arguments above, the following attributes are exported:

- `id` - The ID of the backend stage (UUID format).
- `created_at` - The date and time of the creation of the backend stage.
- `updated_at` - The date and time of the last update of the backend stage.
- `pipeline_id` - The pipeline ID the backend stage belongs to.

## Import

Backend stages can be imported using the `{id}`, e.g.

```bash
$ terraform import scaleway_edge_services_backend_stage.basic 11111111-1111-1111-1111-111111111111
```
59 changes: 59 additions & 0 deletions docs/resources/edge_services_cache_stage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
subcategory: "Edge Services"
page_title: "Scaleway: scaleway_edge_services_cache_stage"
---

# Resource: scaleway_edge_services_cache_stage

Creates and manages Scaleway Edge Services Cache Stages.

## Example Usage

### Basic

```terraform
resource "scaleway_edge_services_cache_stage" "main" {
backend_stage_id = scaleway_edge_services_backend_stage.main.id
}
```

### Purge request

```terraform
resource "scaleway_edge_services_cache_stage" "main" {
backend_stage_id = scaleway_edge_services_backend_stage.main.id

purge {
pipeline_id = scaleway_edge_services_pipeline.main.id
all = true
}
}
```

## Argument Reference

- `backend_stage_id` - (Optional) The backend stage ID the cache stage will be linked to.
- `fallback_ttl` - (Optional) The Time To Live (TTL) in seconds. Defines how long content is cached.
- `refresh_cache` - (Optional) Trigger a refresh of the cache by changing this field's value.
- `purge_requests` - (Optional) The Scaleway Object Storage origin bucket (S3) linked to the backend stage.
- `pipeline_id` - The pipeline ID in which the purge request will be created.
- `assets` - The list of asserts to purge.
- `all` - Defines whether to purge all content.
- `project_id` - (Defaults to [provider](../index.md#project_id) `project_id`) The ID of the project the cache stage is associated with.

## Attributes Reference

In addition to all arguments above, the following attributes are exported:

- `id` - The ID of the cache stage (UUID format).
- `created_at` - The date and time of the creation of the cache stage.
- `updated_at` - The date and time of the last update of the cache stage.
- `pipeline_id` - The pipeline ID the cache stage belongs to.

## Import

Cache stages can be imported using the `{id}`, e.g.

```bash
$ terraform import scaleway_edge_services_cache_stage.basic 11111111-1111-1111-1111-111111111111
```
44 changes: 44 additions & 0 deletions docs/resources/edge_services_dns_stage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
subcategory: "Edge Services"
page_title: "Scaleway: scaleway_edge_services_dns_stage"
---

# Resource: scaleway_edge_services_dns_stage

Creates and manages Scaleway Edge Services DNS Stages.

## Example Usage

### Basic

```terraform
resource "scaleway_edge_services_dns_stage" "main" {
fqdns = ["subdomain.example.com"]
}
```

## Argument Reference

- `backend_stage_id` - (Optional) The backend stage ID the DNS stage will be linked to.
- `tls_stage_id` - (Optional) The TLS stage ID the DNS stage will be linked to.
- `cache_stage_id` - (Optional) The cache stage ID the DNS stage will be linked to.
- `fqdns` - (Optional) Fully Qualified Domain Name (in the format subdomain.example.com) to attach to the stage.
- `project_id` - (Defaults to [provider](../index.md#project_id) `project_id`) The ID of the project the DNS stage is associated with.

## Attributes Reference

In addition to all arguments above, the following attributes are exported:

- `id` - The ID of the DNS stage (UUID format).
- `type` - The type of the stage.
- `created_at` - The date and time of the creation of the DNS stage.
- `updated_at` - The date and time of the last update of the DNS stage.
- `pipeline_id` - The pipeline ID the DNS stage belongs to.

## Import

DNS stages can be imported using the `{id}`, e.g.

```bash
$ terraform import scaleway_edge_services_dns_stage.basic 11111111-1111-1111-1111-111111111111
```
73 changes: 73 additions & 0 deletions docs/resources/edge_services_pipeline.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
subcategory: "Edge Services"
page_title: "Scaleway: scaleway_edge_services_pipeline"
---

# Resource: scaleway_edge_services_pipeline

Creates and manages Scaleway Edge Services Pipelines.

## Example Usage

### Basic

```terraform
resource "scaleway_edge_services_pipeline" "main" {
name = "pipeline-name"
description = "pipeline description"
}
```

### Complete pipeline

```terraform
resource "scaleway_edge_services_backend_stage" "main" {
s3_backend_config {
bucket_name = "my-bucket-name"
bucket_region = "fr-par"
}
}

resource "scaleway_edge_services_tls_stage" "main" {
cache_stage_id = scaleway_edge_services_cache_stage.main.id
managed_certificate = true
}

resource "scaleway_edge_services_dns_stage" "main" {
tls_stage_id = scaleway_edge_services_tls_stage.main.id
fqdns = ["subdomain.example.com"]
}

resource "scaleway_edge_services_pipeline" "main" {
name = "my-edge_services-pipeline"
dns_stage_id = scaleway_edge_services_dns_stage.main.id
}

resource "scaleway_edge_services_cache_stage" "main" {
backend_stage_id = scaleway_edge_services_backend_stage.main.id
}
```

## Argument Reference

- `name` - (Optional) The name of the pipeline.
- `description` - (Optional) The description of the pipeline.
- `dns_stage_id` - (Optional) The DNS stage ID the pipeline will be attached to.
- `project_id` - (Defaults to [provider](../index.md#project_id) `project_id`) The ID of the project the pipeline is associated with.

## Attributes Reference

In addition to all arguments above, the following attributes are exported:

- `id` - The ID of the pipeline (UUID format).
- `created_at` - The date and time of the creation of the pipeline.
- `updated_at` - The date and time of the last update of the pipeline.
- `status` - The status of user pipeline.

## Import

Pipelines can be imported using the `{id}`, e.g.

```bash
$ terraform import scaleway_edge_services_pipeline.basic 11111111-1111-1111-1111-111111111111
```
57 changes: 57 additions & 0 deletions docs/resources/edge_services_tls_stage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
subcategory: "Edge Services"
page_title: "Scaleway: scaleway_edge_services_tls_stage"
---

# Resource: scaleway_edge_services_tls_stage

Creates and manages Scaleway Edge Services TLS Stages.

## Example Usage

### Managed

```terraform
resource "scaleway_edge_services_tls_stage" "main" {
managed_certificate = true
}
```

### With a certificate stored in Scaleway Secret Manager

```terraform
resource "scaleway_edge_services_tls_stage" "main" {
secrets {
secret_id = "11111111-1111-1111-1111-111111111111"
region = "fr-par"
}
}
```

## Argument Reference

- `backend_stage_id` - (Optional) The backend stage ID the TLS stage will be linked to.
- `cache_stage_id` - (Optional) The cache stage ID the TLS stage will be linked to.
- `managed_certificate` - (Optional) Set to true when Scaleway generates and manages a Let's Encrypt certificate for the TLS stage/custom endpoint.
- `secrets` - (Optional) The TLS secrets.
- `bucket_name` - The ID of the secret.
- `region` - The region of the secret.
- `project_id` - (Defaults to [provider](../index.md#project_id) `project_id`) The ID of the project the TLS stage is associated with.

## Attributes Reference

In addition to all arguments above, the following attributes are exported:

- `id` - The ID of the TLS stage (UUID format).
- `certificate_expires_at` - The expiration date of the certificate.
- `created_at` - The date and time of the creation of the TLS stage.
- `updated_at` - The date and time of the last update of the TLS stage.
- `pipeline_id` - The pipeline ID the TLS stage belongs to.

## Import

TLS stages can be imported using the `{id}`, e.g.

```bash
$ terraform import scaleway_edge_services_tls_stage.basic 11111111-1111-1111-1111-111111111111
```
6 changes: 6 additions & 0 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/scaleway/terraform-provider-scaleway/v2/internal/services/container"
"github.com/scaleway/terraform-provider-scaleway/v2/internal/services/documentdb"
"github.com/scaleway/terraform-provider-scaleway/v2/internal/services/domain"
"github.com/scaleway/terraform-provider-scaleway/v2/internal/services/edgeservices"
"github.com/scaleway/terraform-provider-scaleway/v2/internal/services/flexibleip"
"github.com/scaleway/terraform-provider-scaleway/v2/internal/services/function"
"github.com/scaleway/terraform-provider-scaleway/v2/internal/services/iam"
Expand Down Expand Up @@ -142,6 +143,11 @@ func Provider(config *Config) plugin.ProviderFunc {
"scaleway_documentdb_user": documentdb.ResourceUser(),
"scaleway_domain_record": domain.ResourceRecord(),
"scaleway_domain_zone": domain.ResourceZone(),
"scaleway_edge_services_backend_stage": edgeservices.ResourceEdgeServicesBackendStage(),
"scaleway_edge_services_cache_stage": edgeservices.ResourceEdgeServicesCacheStage(),
"scaleway_edge_services_dns_stage": edgeservices.ResourceEdgeServicesDNSStage(),
"scaleway_edge_services_pipeline": edgeservices.ResourceEdgeServicesPipeline(),
"scaleway_edge_services_tls_stage": edgeservices.ResourceEdgeServicesTLSStage(),
"scaleway_flexible_ip": flexibleip.ResourceIP(),
"scaleway_flexible_ip_mac_address": flexibleip.ResourceMACAddress(),
"scaleway_function": function.ResourceFunction(),
Expand Down
Loading
Loading