Skip to content

Commit e17589f

Browse files
committed
feat(k8s): add support for project id
1 parent f8df310 commit e17589f

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

docs/resources/k8s_cluster_beta.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ The following arguments are supported:
158158

159159
- `organization_id` - (Defaults to [provider](../index.md#organization_id) `organization_id`) The ID of the organization the cluster is associated with.
160160

161+
- `project_id` - (Defaults to [provider](../index.md#project_id) `project_id`) The ID of the project the cluster is associated with.
162+
161163

162164
## Attributes Reference
163165

scaleway/helpers.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,18 @@ func organizationIDSchema() *schema.Schema {
227227
}
228228
}
229229

230+
// projectIDSchema returns a standard schema for a project_id
231+
func projectIDSchema() *schema.Schema {
232+
return &schema.Schema{
233+
Type: schema.TypeString,
234+
Description: "The project_id you want to attach the resource to",
235+
Optional: true,
236+
ForceNew: true,
237+
Computed: true,
238+
ValidateFunc: validationUUID(),
239+
}
240+
}
241+
230242
// zoneSchema returns a standard schema for a zone
231243
func zoneSchema() *schema.Schema {
232244
return &schema.Schema{

scaleway/resource_k8s_cluster_beta.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ func resourceScalewayK8SClusterBeta() *schema.Resource {
280280
},
281281
"region": regionSchema(),
282282
"organization_id": organizationIDSchema(),
283+
"project_id": projectIDSchema(),
283284
// Computed elements
284285
"created_at": {
285286
Type: schema.TypeString,
@@ -362,6 +363,7 @@ func resourceScalewayK8SClusterBetaCreate(d *schema.ResourceData, m interface{})
362363
req := &k8s.CreateClusterRequest{
363364
Region: region,
364365
OrganizationID: expandStringPtr(d.Get("organization_id")),
366+
ProjectID: expandStringPtr(d.Get("project_id")),
365367
Name: expandOrGenerateString(d.Get("name"), "cluster"),
366368
Description: description.(string),
367369
Cni: k8s.CNI(d.Get("cni").(string)),

0 commit comments

Comments
 (0)