Skip to content

Commit 83bd23f

Browse files
committed
fix(cockpit): correct Cockpit Grafana URL format
1 parent 1b802af commit 83bd23f

File tree

4 files changed

+206
-2
lines changed

4 files changed

+206
-2
lines changed

internal/services/cockpit/cockpit_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ func checkGrafanaURL(resourceName, projectResource string) resource.TestCheckFun
146146
}
147147

148148
projectID := rs.Primary.ID
149-
expectedURL := fmt.Sprintf("https://%s.dashboards.obs.fr-par.scw.cloud", projectID)
149+
expectedURL := fmt.Sprintf("https://%s.dashboard.obs.fr-par.scw.cloud", projectID)
150150

151151
return resource.TestCheckResourceAttr(resourceName, "endpoints.0.grafana_url", expectedURL)(s)
152152
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
version: 2
3+
interactions: []
Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
---
2+
version: 2
3+
interactions:
4+
- id: 0
5+
request:
6+
proto: HTTP/1.1
7+
proto_major: 1
8+
proto_minor: 1
9+
content_length: 128
10+
transfer_encoding: []
11+
trailer: {}
12+
host: api.scaleway.com
13+
remote_addr: ""
14+
request_uri: ""
15+
body: '{"name":"tf_tests_cockpit_datasource_import_identity","organization_id":"105bdce1-64c0-48ab-899d-868455867ecf","description":""}'
16+
form: {}
17+
headers:
18+
Content-Type:
19+
- application/json
20+
User-Agent:
21+
- scaleway-sdk-go/v1.0.0-beta.7+dev (go1.24.0; darwin; arm64) terraform-provider/develop terraform/terraform-tests
22+
url: https://api.scaleway.com/account/v3/projects
23+
method: POST
24+
response:
25+
proto: HTTP/2.0
26+
proto_major: 2
27+
proto_minor: 0
28+
transfer_encoding: []
29+
trailer: {}
30+
content_length: 285
31+
uncompressed: false
32+
body: '{"created_at":"2025-06-13T10:18:48.022747Z","description":"","id":"aacb5d9e-97da-4b82-9a85-4c2b554392c6","name":"tf_tests_cockpit_datasource_import_identity","organization_id":"105bdce1-64c0-48ab-899d-868455867ecf","qualification":null,"updated_at":"2025-06-13T10:18:48.022747Z"}'
33+
headers:
34+
Content-Length:
35+
- "285"
36+
Content-Security-Policy:
37+
- default-src 'none'; frame-ancestors 'none'
38+
Content-Type:
39+
- application/json
40+
Date:
41+
- Fri, 13 Jun 2025 10:18:48 GMT
42+
Server:
43+
- Scaleway API Gateway (fr-par-1;edge01)
44+
Strict-Transport-Security:
45+
- max-age=63072000
46+
X-Content-Type-Options:
47+
- nosniff
48+
X-Frame-Options:
49+
- DENY
50+
X-Request-Id:
51+
- 3c24d623-a627-4cfb-9ca1-a8d493eb1cac
52+
status: 200 OK
53+
code: 200
54+
duration: 929.763ms
55+
- id: 1
56+
request:
57+
proto: HTTP/1.1
58+
proto_major: 1
59+
proto_minor: 1
60+
content_length: 0
61+
transfer_encoding: []
62+
trailer: {}
63+
host: api.scaleway.com
64+
remote_addr: ""
65+
request_uri: ""
66+
body: ""
67+
form: {}
68+
headers:
69+
User-Agent:
70+
- scaleway-sdk-go/v1.0.0-beta.7+dev (go1.24.0; darwin; arm64) terraform-provider/develop terraform/terraform-tests
71+
url: https://api.scaleway.com/account/v3/projects/aacb5d9e-97da-4b82-9a85-4c2b554392c6
72+
method: GET
73+
response:
74+
proto: HTTP/2.0
75+
proto_major: 2
76+
proto_minor: 0
77+
transfer_encoding: []
78+
trailer: {}
79+
content_length: 330
80+
uncompressed: false
81+
body: '{"created_at":"2025-06-13T10:18:48.022747Z","description":"","id":"aacb5d9e-97da-4b82-9a85-4c2b554392c6","name":"tf_tests_cockpit_datasource_import_identity","organization_id":"105bdce1-64c0-48ab-899d-868455867ecf","qualification":{"architecture_type":"unknown_architecture_type"},"updated_at":"2025-06-13T10:18:48.022747Z"}'
82+
headers:
83+
Content-Length:
84+
- "330"
85+
Content-Security-Policy:
86+
- default-src 'none'; frame-ancestors 'none'
87+
Content-Type:
88+
- application/json
89+
Date:
90+
- Fri, 13 Jun 2025 10:18:48 GMT
91+
Server:
92+
- Scaleway API Gateway (fr-par-1;edge01)
93+
Strict-Transport-Security:
94+
- max-age=63072000
95+
X-Content-Type-Options:
96+
- nosniff
97+
X-Frame-Options:
98+
- DENY
99+
X-Request-Id:
100+
- fbeaa66c-71e1-4d77-8708-04e00c8293a1
101+
status: 200 OK
102+
code: 200
103+
duration: 156.196042ms
104+
- id: 2
105+
request:
106+
proto: HTTP/1.1
107+
proto_major: 1
108+
proto_minor: 1
109+
content_length: 100
110+
transfer_encoding: []
111+
trailer: {}
112+
host: api.scaleway.com
113+
remote_addr: ""
114+
request_uri: ""
115+
body: '{"project_id":"aacb5d9e-97da-4b82-9a85-4c2b554392c6","name":"","type":"metrics","retention_days":31}'
116+
form: {}
117+
headers:
118+
Content-Type:
119+
- application/json
120+
User-Agent:
121+
- scaleway-sdk-go/v1.0.0-beta.7+dev (go1.24.0; darwin; arm64) terraform-provider/develop terraform/terraform-tests
122+
url: https://api.scaleway.com/cockpit/v1/regions/fr-par/data-sources
123+
method: POST
124+
response:
125+
proto: HTTP/2.0
126+
proto_major: 2
127+
proto_minor: 0
128+
transfer_encoding: []
129+
trailer: {}
130+
content_length: 313
131+
uncompressed: false
132+
body: '{"details":[{"argument_name":"name","help_message":"value length must be between 3 and 50 runes, inclusive","reason":"constraint"},{"argument_name":"name","help_message":"value does not match regex pattern \"^[A-Za-z0-9-_. ]+$\"","reason":"constraint"}],"message":"invalid argument(s)","type":"invalid_arguments"}'
133+
headers:
134+
Content-Length:
135+
- "313"
136+
Content-Security-Policy:
137+
- default-src 'none'; frame-ancestors 'none'
138+
Content-Type:
139+
- application/json
140+
Date:
141+
- Fri, 13 Jun 2025 10:18:48 GMT
142+
Server:
143+
- Scaleway API Gateway (fr-par-1;edge01)
144+
Strict-Transport-Security:
145+
- max-age=63072000
146+
X-Content-Type-Options:
147+
- nosniff
148+
X-Frame-Options:
149+
- DENY
150+
X-Request-Id:
151+
- 358b8c22-455a-472e-864d-9e24043bc88c
152+
status: 400 Bad Request
153+
code: 400
154+
duration: 26.134375ms
155+
- id: 3
156+
request:
157+
proto: HTTP/1.1
158+
proto_major: 1
159+
proto_minor: 1
160+
content_length: 0
161+
transfer_encoding: []
162+
trailer: {}
163+
host: api.scaleway.com
164+
remote_addr: ""
165+
request_uri: ""
166+
body: ""
167+
form: {}
168+
headers:
169+
User-Agent:
170+
- scaleway-sdk-go/v1.0.0-beta.7+dev (go1.24.0; darwin; arm64) terraform-provider/develop terraform/terraform-tests
171+
url: https://api.scaleway.com/account/v3/projects/aacb5d9e-97da-4b82-9a85-4c2b554392c6
172+
method: DELETE
173+
response:
174+
proto: HTTP/2.0
175+
proto_major: 2
176+
proto_minor: 0
177+
transfer_encoding: []
178+
trailer: {}
179+
content_length: 0
180+
uncompressed: false
181+
body: ""
182+
headers:
183+
Content-Security-Policy:
184+
- default-src 'none'; frame-ancestors 'none'
185+
Content-Type:
186+
- application/json
187+
Date:
188+
- Fri, 13 Jun 2025 10:18:50 GMT
189+
Server:
190+
- Scaleway API Gateway (fr-par-1;edge01)
191+
Strict-Transport-Security:
192+
- max-age=63072000
193+
X-Content-Type-Options:
194+
- nosniff
195+
X-Frame-Options:
196+
- DENY
197+
X-Request-Id:
198+
- 30000dd4-9410-454a-b782-2fe0b4110dae
199+
status: 204 No Content
200+
code: 204
201+
duration: 1.25992225s

internal/services/cockpit/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ var scopeMapping = map[string]cockpit.TokenScope{
2020
}
2121

2222
func createGrafanaURL(projectID string, region scw.Region) string {
23-
return fmt.Sprintf("https://%s.dashboards.obs.%s.scw.cloud", projectID, region)
23+
return fmt.Sprintf("https://%s.dashboard.obs.%s.scw.cloud", projectID, region)
2424
}
2525

2626
func flattenCockpitEndpoints(dataSources []*cockpit.DataSource, grafanaURL string, alertManagerURL string) []map[string]any {

0 commit comments

Comments
 (0)