Skip to content

Commit c0ba311

Browse files
committed
fix(meta): avoid ExtractScwClient to panic
1 parent 78d3157 commit c0ba311

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

internal/meta/extractors.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,14 @@ func ExtractProjectID(d terraformResourceData, m interface{}) (projectID string,
9494
}
9595

9696
func ExtractScwClient(m interface{}) *scw.Client {
97-
return m.(*Meta).ScwClient()
97+
switch client := m.(type) {
98+
case *Meta:
99+
return client.ScwClient()
100+
case *scw.Client:
101+
return client
102+
default:
103+
return nil
104+
}
98105
}
99106

100107
func ExtractHTTPClient(m interface{}) *http.Client {

0 commit comments

Comments
 (0)