Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions internal/services/account/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
accountSDK "github.com/scaleway/scaleway-sdk-go/api/account/v3"
"github.com/scaleway/scaleway-sdk-go/scw"
"github.com/scaleway/terraform-provider-scaleway/v2/internal/httperrors"
"github.com/scaleway/terraform-provider-scaleway/v2/internal/identity"
"github.com/scaleway/terraform-provider-scaleway/v2/internal/types"
"github.com/scaleway/terraform-provider-scaleway/v2/internal/verify"
)
Expand All @@ -29,6 +30,7 @@
},
SchemaVersion: 0,
SchemaFunc: projectSchema,
Identity: identity.DefaultProjectID(),
}
}

Expand Down Expand Up @@ -83,7 +85,10 @@
return diag.FromErr(err)
}

d.SetId(res.ID)
err = identity.SetFlatIdentity(d, "project_id", res.ID)

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / test-scwconfig

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / coverage

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (baremetal)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (account)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (az)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (billing)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / build

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / tfproviderlint

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / tfproviderlint

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (datawarehouse)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (block)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / tests

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (vpcgw)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (domain)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (lb)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (applesilicon)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (object)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (container)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (sdb)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (iam)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (redis)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (container)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (file)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (inference)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (registry)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (mongodb)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (audittrail)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (registry)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (k8s)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (flexibleip)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (secret)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (billing)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (instance)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (object)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (keymanager)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (file)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (edgeservices)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (iot)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (mnq)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (jobs)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (vpc)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (ipam)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (instance)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (flexibleip)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (marketplace)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (function)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (tem)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (rdb)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (keymanager)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (k8s)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (cockpit)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (secret)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (az)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (marketplace)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (jobs)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (inference)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (datawarehouse)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (iam)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (vpc)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (function)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (edgeservices)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (tem)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (domain)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (sdb)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (lb)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (account)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (redis)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (mnq)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (cockpit)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (applesilicon)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (mongodb)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (block)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (baremetal)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (iot)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (rdb)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (ipam)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (vpcgw)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (webhosting)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (audittrail)

undefined: identity.SetFlatIdentity

Check failure on line 88 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (webhosting)

undefined: identity.SetFlatIdentity
if err != nil {
return diag.FromErr(err)
}

return resourceAccountProjectRead(ctx, d, m)
}
Expand All @@ -104,13 +109,22 @@
return diag.FromErr(err)
}

err = identity.SetFlatIdentity(d, "project_id", res.ID)

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / test-scwconfig

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / coverage

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (baremetal)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (account)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (az)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (billing)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / build

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / tfproviderlint

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / tfproviderlint

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (datawarehouse)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (block)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / tests

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (vpcgw)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (domain)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (lb)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (applesilicon)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (object)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (container)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (sdb)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (iam)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (redis)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (container)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (file)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (inference)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (registry)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (mongodb)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (audittrail)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (registry)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (k8s)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (flexibleip)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (secret)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (billing)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (instance)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (object)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (keymanager)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (file)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (edgeservices)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (iot)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (mnq)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (jobs)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (vpc)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (ipam)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (instance)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (flexibleip)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (marketplace)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (function)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (tem)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (rdb)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (keymanager)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (k8s)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (cockpit)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (secret)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (az)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (marketplace)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (jobs)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (inference)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (datawarehouse)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (iam)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (vpc)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (function)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (edgeservices)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (tem)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (domain)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (sdb)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (lb)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (account)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (redis)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (mnq)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (cockpit)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (applesilicon)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (mongodb)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (block)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (baremetal)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (iot)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (rdb)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (ipam)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (vpcgw)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (webhosting)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / opentofu (audittrail)

undefined: identity.SetFlatIdentity

Check failure on line 112 in internal/services/account/project.go

View workflow job for this annotation

GitHub Actions / terraform (webhosting)

undefined: identity.SetFlatIdentity
if err != nil {
return diag.FromErr(err)
}

setProjectState(d, res)

return nil
}

func setProjectState(d *schema.ResourceData, res *accountSDK.Project) {
_ = d.Set("name", res.Name)
_ = d.Set("description", res.Description)
_ = d.Set("created_at", types.FlattenTime(res.CreatedAt))
_ = d.Set("updated_at", types.FlattenTime(res.UpdatedAt))
_ = d.Set("organization_id", res.OrganizationID)

return nil
}

func resourceAccountProjectUpdate(ctx context.Context, d *schema.ResourceData, m any) diag.Diagnostics {
Expand Down
17 changes: 14 additions & 3 deletions internal/services/account/project_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
accountSDK "github.com/scaleway/scaleway-sdk-go/api/account/v3"
"github.com/scaleway/scaleway-sdk-go/scw"
"github.com/scaleway/terraform-provider-scaleway/v2/internal/datasource"
"github.com/scaleway/terraform-provider-scaleway/v2/internal/httperrors"
"github.com/scaleway/terraform-provider-scaleway/v2/internal/meta"
"github.com/scaleway/terraform-provider-scaleway/v2/internal/types"
"github.com/scaleway/terraform-provider-scaleway/v2/internal/verify"
Expand Down Expand Up @@ -79,11 +80,21 @@ func DataSourceAccountProjectRead(ctx context.Context, d *schema.ResourceData, m
d.SetId(projectID)
_ = d.Set("project_id", projectID)

diags := resourceAccountProjectRead(ctx, d, m)
if diags != nil {
return append(diags, diag.Errorf("failed to read account project")...)
res, err := accountAPI.GetProject(&accountSDK.ProjectAPIGetProjectRequest{
ProjectID: d.Id(),
}, scw.WithContext(ctx))
if err != nil {
if httperrors.Is404(err) {
d.SetId("")

return nil
}

return diag.FromErr(err)
}

setProjectState(d, res)

if d.Id() == "" {
return diag.Errorf("account project (%s) not found", projectID)
}
Comment on lines +83 to 100
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this data source, a 404 now returns nil diagnostics (after clearing the ID), which changes behavior from the previous implementation that surfaced a "not found" error (via the later if d.Id() == "" check). For data sources, silently succeeding on missing remote objects can mask configuration issues; additionally, the if d.Id() == "" block becomes effectively unreachable with the early return. Consider handling 404 by setting the ID empty and then returning the existing account project (...) not found diagnostic (or directly returning that diagnostic on 404), and remove/adjust the now-dead code accordingly.

Copilot uses AI. Check for mistakes.
Expand Down
10 changes: 10 additions & 0 deletions internal/services/account/project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ func TestAccProject_Basic(t *testing.T) {
resource.TestCheckResourceAttr("scaleway_account_project.main", "description", "another description"),
),
},
{
ResourceName: "scaleway_account_project.main",
ImportState: true,
ImportStateVerify: true,
},
},
})
}
Expand Down Expand Up @@ -83,6 +88,11 @@ func TestAccProject_NoUpdate(t *testing.T) {
isProjectPresent(tt, "scaleway_account_project.main"),
),
},
{
ResourceName: "scaleway_account_project.main",
ImportState: true,
ImportStateVerify: true,
},
},
})
}
Expand Down
Loading