Skip to content

Commit 93603b9

Browse files
Merge branch 'master' into feat/audit-trail-event-data-source
2 parents 982f867 + e9e8231 commit 93603b9

29 files changed

+2511
-1308
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
---
2+
subcategory: "Cockpit"
3+
page_title: "Scaleway: scaleway_cockpit_grafana"
4+
---
5+
6+
# Data Source: scaleway_cockpit_grafana
7+
8+
Gets information about Scaleway Cockpit's Grafana instance for a specific project.
9+
10+
This data source provides the Grafana URL and project details. Authentication is managed through [Scaleway IAM (Identity and Access Management)](https://www.scaleway.com/en/docs/identity-and-access-management/iam/).
11+
12+
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.
13+
14+
## Example Usage
15+
16+
### Basic usage
17+
18+
```terraform
19+
data "scaleway_cockpit_grafana" "main" {
20+
project_id = scaleway_account_project.project.id
21+
}
22+
23+
output "grafana_url" {
24+
value = data.scaleway_cockpit_grafana.main.grafana_url
25+
description = "Access Grafana using your Scaleway IAM credentials"
26+
}
27+
```
28+
29+
### Using with default project
30+
31+
```terraform
32+
# Uses the default project from provider configuration
33+
data "scaleway_cockpit_grafana" "main" {}
34+
35+
output "grafana_url" {
36+
value = data.scaleway_cockpit_grafana.main.grafana_url
37+
}
38+
```
39+
40+
### Complete example with Cockpit setup
41+
42+
```terraform
43+
resource "scaleway_account_project" "project" {
44+
name = "my-observability-project"
45+
}
46+
47+
resource "scaleway_cockpit" "main" {
48+
project_id = scaleway_account_project.project.id
49+
}
50+
51+
data "scaleway_cockpit_grafana" "main" {
52+
project_id = scaleway_cockpit.main.project_id
53+
}
54+
55+
output "grafana_connection_info" {
56+
value = {
57+
url = data.scaleway_cockpit_grafana.main.grafana_url
58+
project_id = data.scaleway_cockpit_grafana.main.project_id
59+
}
60+
description = "Use your Scaleway IAM credentials to authenticate"
61+
}
62+
```
63+
64+
## Argument Reference
65+
66+
- `project_id` - (Optional) The ID of the project the Grafana instance is associated with. If not provided, the default project configured in the provider is used.
67+
68+
## Attributes Reference
69+
70+
In addition to all arguments above, the following attributes are exported:
71+
72+
- `id` - The ID of the project (same as `project_id`).
73+
- `grafana_url` - The URL to access the Grafana dashboard. Use your Scaleway IAM credentials to authenticate.
74+
75+
## Authentication
76+
77+
To access Grafana, use your Scaleway IAM credentials:
78+
79+
1. Navigate to the `grafana_url` provided by this data source
80+
2. Sign in using your Scaleway account (IAM authentication)
81+
3. Your access level is determined by your IAM permissions on the project
82+
83+
For more information about IAM authentication, see the [Scaleway IAM documentation](https://www.scaleway.com/en/docs/identity-and-access-management/iam/).
84+

docs/guides/migration_guide_cockpit_plan.md

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,15 @@ resource "scaleway_cockpit_alert_manager" "alert_manager" {
109109
}
110110
```
111111

112-
**Grafana User:**
112+
**Grafana Access:**
113113

114-
To retrieve the deprecated `grafana_url`, you must create a Grafana user. Creating the user will trigger the creation of the Grafana instance:
114+
~> **Note:** The `scaleway_cockpit_grafana_user` resource is deprecated and will be removed on January 1st, 2026. Grafana authentication is now managed through Scaleway IAM.
115+
116+
To retrieve the Grafana URL, use the `scaleway_cockpit_grafana` data source. Authentication is handled via your Scaleway IAM credentials:
115117

116118
```hcl
117-
resource "scaleway_cockpit_grafana_user" "main" {
119+
data "scaleway_cockpit_grafana" "main" {
118120
project_id = scaleway_account_project.project.id
119-
login = "my-awesome-user"
120-
role = "editor"
121121
}
122122
```
123123

@@ -172,10 +172,8 @@ resource "scaleway_cockpit_alert_manager" "alert_manager" {
172172
enable_managed_alerts = true
173173
}
174174
175-
resource "scaleway_cockpit_grafana_user" "main" {
175+
data "scaleway_cockpit_grafana" "main" {
176176
project_id = scaleway_account_project.project.id
177-
login = "my-awesome-user"
178-
role = "editor"
179177
}
180178
181179
output "endpoints" {
@@ -184,8 +182,9 @@ output "endpoints" {
184182
logs = scaleway_cockpit_source.logs.url
185183
traces = scaleway_cockpit_source.traces.url
186184
alert_manager = scaleway_cockpit_alert_manager.alert_manager.alert_manager_url
187-
grafana = scaleway_cockpit_grafana_user.main.grafana_url
185+
grafana = data.scaleway_cockpit_grafana.main.grafana_url
188186
}
187+
description = "Use your Scaleway IAM credentials to authenticate to Grafana"
189188
}
190189
```
191190

@@ -199,12 +198,16 @@ To import an existing `scaleway_cockpit_source` resource:
199198
terraform import scaleway_cockpit_source.main fr-par/11111111-1111-1111-1111-111111111111
200199
```
201200

202-
### Import a Grafana User
201+
### Grafana Data Source
203202

204-
To import an existing Grafana user:
203+
~> **Note:** The `scaleway_cockpit_grafana_user` resource is deprecated. Grafana authentication is now handled via Scaleway IAM, and no import is needed for the data source.
205204

206-
```bash
207-
terraform import scaleway_cockpit_grafana_user.main 11111111-1111-1111-1111-111111111111
205+
The `scaleway_cockpit_grafana` data source automatically retrieves Grafana information. No import is required:
206+
207+
```hcl
208+
data "scaleway_cockpit_grafana" "main" {
209+
project_id = scaleway_account_project.project.id
210+
}
208211
```
209212

210213
## Conclusion

docs/resources/cockpit.md

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ page_title: "Scaleway: scaleway_cockpit"
99

1010
- `scaleway_cockpit_source` for managing data sources (metrics, logs, traces)
1111
- `scaleway_cockpit_alert_manager` for managing alert manager
12-
- `scaleway_cockpit_grafana_user` for managing Grafana users
12+
- `scaleway_cockpit_grafana` data source for accessing Grafana (authentication via IAM)
1313

1414
For detailed migration instructions, see the [Cockpit Migration Guide](../guides/migration_guide_cockpit_plan.md).
1515

@@ -20,7 +20,7 @@ If you have created customized dashboards with data for your Scaleway resources
2020
-> **Note:**
2121
From January 1st 2025, Cockpit plans have been deprecated. You can now edit the retention period for all your datasources (metrics, logs, and traces) separately. Refer to our product documentation for more information on [possible retention values](https://www.scaleway.com/en/docs/cockpit/concepts/#retention) and [pricing](https://www.scaleway.com/en/docs/cockpit/faq/#how-am-i-billed-for-increasing-data-retention-period).
2222

23-
Please note that even if you provide the grafana_url, it will only be active if a [Grafana user](../resources/cockpit_grafana_user.md) is created first. Make sure to create a Grafana user in your Cockpit instance to enable full access to Grafana.
23+
~> **Note:** The `scaleway_cockpit_grafana_user` resource is deprecated. Use the [`scaleway_cockpit_grafana` data source](../data-sources/cockpit_grafana.md) to retrieve the Grafana URL and authenticate using your Scaleway IAM credentials.
2424

2525
The `scaleway_cockpit` resource allows you to create and manage Scaleway Cockpit instances.
2626

@@ -53,27 +53,30 @@ resource "scaleway_cockpit" "main" {
5353
}
5454
```
5555

56-
### Use the Grafana Terraform provider
56+
### Use the Grafana Terraform provider (Deprecated)
5757

58-
```terraform
59-
// Use the Grafana Terraform provider to create a Grafana user and a Grafana folder in the default Project's Cockpit
58+
~> **Note:** This example is deprecated. Use the `scaleway_cockpit_grafana` data source with IAM authentication instead.
6059

61-
resource "scaleway_cockpit_grafana_user" "main" {
60+
```terraform
61+
// Old approach (deprecated) - Using scaleway_cockpit_grafana_user
62+
// resource "scaleway_cockpit_grafana_user" "main" {
63+
// project_id = scaleway_cockpit.main.project_id
64+
// login = "example"
65+
// role = "editor"
66+
// }
67+
//
68+
// provider "grafana" {
69+
// url = scaleway_cockpit.main.endpoints.0.grafana_url
70+
// auth = "${scaleway_cockpit_grafana_user.main.login}:${scaleway_cockpit_grafana_user.main.password}"
71+
// }
72+
73+
// New approach - Use scaleway_cockpit_grafana data source with IAM auth
74+
data "scaleway_cockpit_grafana" "main" {
6275
project_id = scaleway_cockpit.main.project_id
63-
login = "example"
64-
role = "editor"
6576
}
6677
67-
resource "scaleway_cockpit" "main" {}
68-
69-
provider "grafana" {
70-
url = scaleway_cockpit.main.endpoints.0.grafana_url
71-
auth = "${scaleway_cockpit_grafana_user.main.login}:${scaleway_cockpit_grafana_user.main.password}"
72-
}
73-
74-
resource "grafana_folder" "test_folder" {
75-
title = "Test Folder"
76-
}
78+
// Note: Grafana provider with IAM auth requires proper token setup
79+
// See Grafana provider documentation for IAM authentication
7780
```
7881

7982
## Argument Reference
@@ -104,7 +107,7 @@ This resource is deprecated and will be removed after January 1st, 2025. To migr
104107

105108
- `scaleway_cockpit_source` for managing data sources (metrics, logs, traces)
106109
- `scaleway_cockpit_alert_manager` for managing alert manager
107-
- `scaleway_cockpit_grafana_user` for managing Grafana users
110+
- `scaleway_cockpit_grafana` data source for accessing Grafana (with IAM authentication)
108111

109112
## Import
110113

docs/resources/cockpit_grafana_user.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,40 @@ page_title: "Scaleway: scaleway_cockpit_grafana_user"
55

66
# Resource: scaleway_cockpit_grafana_user
77

8+
~> **Deprecated:** This resource is deprecated and will be removed on **January 1st, 2026**.
9+
10+
~> **Migration Guide:** Grafana authentication is now managed through [Scaleway IAM (Identity and Access Management)](https://www.scaleway.com/en/docs/identity-and-access-management/iam/). To access your Grafana instance, use the [`scaleway_cockpit_grafana` data source](../data-sources/cockpit_grafana.md) to retrieve the Grafana URL and authenticate using your Scaleway IAM credentials.
11+
812
The `scaleway_cockpit_grafana_user` resource allows you to create and manage [Grafana users](https://www.scaleway.com/en/docs/observability/cockpit/concepts/#grafana-users) in Scaleway Cockpit.
913

1014
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.
1115

1216
## Example Usage
1317

14-
### Create a Grafana user
18+
### Migration to IAM Authentication
19+
20+
Instead of managing Grafana users, retrieve your Grafana URL using the data source:
21+
22+
```terraform
23+
# Old approach (deprecated)
24+
# resource "scaleway_cockpit_grafana_user" "main" {
25+
# project_id = scaleway_account_project.project.id
26+
# login = "my-awesome-user"
27+
# role = "editor"
28+
# }
29+
30+
# New approach - Use IAM authentication
31+
data "scaleway_cockpit_grafana" "main" {
32+
project_id = scaleway_account_project.project.id
33+
}
34+
35+
output "grafana_url" {
36+
value = data.scaleway_cockpit_grafana.main.grafana_url
37+
description = "Access Grafana using your Scaleway IAM credentials"
38+
}
39+
```
40+
41+
### Create a Grafana user (Deprecated)
1542

1643
The following command allows you to create a Grafana user within a specific Scaleway Project.
1744

docs/resources/instance_server.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,8 @@ To retrieve more information by label please use: ```scw marketplace image get l
245245
- `delete_on_termination` - (Defaults to `true`) Forces deletion of the root volume on instance termination.
246246
- `sbs_iops` - (Optional) Choose IOPS of your sbs volume, has to be used with `sbs_volume` for root volume type.
247247

248-
~> **Important:** Updates to `root_volume.size_in_gb` will be ignored after the creation of the server.
248+
~> **Important:** It is not possible to change `root_volume.size_in_gb` for local volumes (`l_ssd`). Changes to this field will recreate the server.
249+
It is possible to increase `root_volume.size_in_gb` for SBS volumes, but they cannot be resized down without recreating the server.
249250

250251
- `additional_volume_ids` - (Optional) The [additional volumes](https://www.scaleway.com/en/developers/api/instance/#path-volume-types-list-volume-types)
251252
attached to the server. Updates to this field will trigger a stop/start of the server.

docs/resources/instance_volume.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ The following arguments are supported:
2424

2525
- `type` - (Required) The type of the volume. The possible values are: `l_ssd` (Local SSD), `scratch` (Local Scratch SSD).
2626
- `size_in_gb` - (Optional) The size of the volume. Only one of `size_in_gb` and `from_snapshot_id` should be specified.
27+
28+
~> **Important:** It is not possible to resize local and scratch volumes. Updates to this field will recreate the resource.
29+
2730
- `from_snapshot_id` - (Optional) If set, the new volume will be created from this snapshot. Only one of `size_in_gb` and `from_snapshot_id` should be specified.
2831
- `name` - (Optional) The name of the volume. If not provided it will be randomly generated.
2932
- `zone` - (Defaults to [provider](../index.md#zone) `zone`) The [zone](../guides/regions_and_zones.md#zones) in which the volume should be created.

internal/services/cockpit/cockpit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func ResourceCockpit() *schema.Resource {
9090
},
9191
},
9292
},
93-
DeprecationMessage: "The scaleway_cockpit resource is deprecated and will be removed after January 1st, 2025. Use the new specialized resources instead: scaleway_cockpit_source, scaleway_cockpit_alert_manager, and scaleway_cockpit_grafana_user.",
93+
DeprecationMessage: "The scaleway_cockpit resource is deprecated and will be removed after January 1st, 2025. Use the new specialized resources instead: scaleway_cockpit_source and scaleway_cockpit_alert_manager. For Grafana access, use the scaleway_cockpit_grafana data source with IAM authentication (the scaleway_cockpit_grafana_user resource is also deprecated).",
9494
}
9595
}
9696

internal/services/cockpit/cockpit_test.go

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -97,28 +97,21 @@ func TestAccCockpit_WithSourceEndpoints(t *testing.T) {
9797
type = "traces"
9898
}
9999
100-
resource "scaleway_cockpit_alert_manager" "alert_manager" {
101-
project_id = scaleway_account_project.project.id
102-
enable_managed_alerts = true
103-
}
104-
105-
resource "scaleway_cockpit_grafana_user" "main" {
106-
project_id = scaleway_account_project.project.id
107-
login = "cockpit_test_endpoint"
108-
role = "editor"
109-
}
110-
111-
resource "scaleway_cockpit" "main" {
112-
project_id = scaleway_account_project.project.id
113-
plan = "premium"
114-
depends_on = [
115-
scaleway_cockpit_source.metrics,
116-
scaleway_cockpit_source.logs,
117-
scaleway_cockpit_source.traces,
118-
scaleway_cockpit_alert_manager.alert_manager,
119-
scaleway_cockpit_grafana_user.main
120-
]
121-
}
100+
resource "scaleway_cockpit_alert_manager" "alert_manager" {
101+
project_id = scaleway_account_project.project.id
102+
enable_managed_alerts = true
103+
}
104+
105+
resource "scaleway_cockpit" "main" {
106+
project_id = scaleway_account_project.project.id
107+
plan = "premium"
108+
depends_on = [
109+
scaleway_cockpit_source.metrics,
110+
scaleway_cockpit_source.logs,
111+
scaleway_cockpit_source.traces,
112+
scaleway_cockpit_alert_manager.alert_manager
113+
]
114+
}
122115
`,
123116
Check: resource.ComposeTestCheckFunc(
124117
resource.TestCheckResourceAttr("scaleway_cockpit.main", "plan", "premium"),

0 commit comments

Comments
 (0)