Skip to content

feat(account): add support for identity in project resource#3660

Draft
remyleone wants to merge 1 commit intoscaleway:mainfrom
remyleone:identity_account
Draft

feat(account): add support for identity in project resource#3660
remyleone wants to merge 1 commit intoscaleway:mainfrom
remyleone:identity_account

Conversation

@remyleone
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings February 11, 2026 17:14
@remyleone remyleone requested a review from a team as a code owner February 11, 2026 17:14
@github-actions github-actions bot added the account Account issues, bugs and feature requests label Feb 11, 2026
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Feb 11, 2026

Codecov Report

❌ Patch coverage is 0% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 2.33%. Comparing base (a899229) to head (0a3f17e).
⚠️ Report is 48 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
internal/services/account/project.go 0.00% 10 Missing ⚠️
internal/services/account/project_data_source.go 0.00% 9 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##            main   #3660      +/-   ##
========================================
- Coverage   2.33%   2.33%   -0.01%     
========================================
  Files        453     453              
  Lines      49839   49853      +14     
========================================
- Hits        1165    1163       -2     
- Misses     48582   48597      +15     
- Partials      92      93       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds Terraform Identity support to the scaleway_account_project resource so project identity can be tracked via project_id, and updates related read/state-setting logic plus acceptance coverage.

Changes:

  • Add Identity: identity.DefaultProjectID() to the account project resource and set identity via identity.SetFlatIdentity on create/read.
  • Refactor shared project state population into setProjectState and reuse it from the data source.
  • Extend acceptance tests to verify resource import for the project resource.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
internal/services/account/project.go Adds project identity support and uses SetFlatIdentity; extracts setProjectState helper.
internal/services/account/project_data_source.go Reworks data source read path to avoid calling resource read (now identity-dependent) and sets state via setProjectState.
internal/services/account/project_test.go Adds import-state verification steps to acceptance tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +83 to 100
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)
}
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.
@remyleone remyleone deleted the branch scaleway:main February 27, 2026 10:20
@remyleone remyleone closed this Feb 27, 2026
@yfodil yfodil reopened this Feb 27, 2026
@yfodil yfodil changed the base branch from master to main February 27, 2026 10:29
@remyleone remyleone marked this pull request as draft March 12, 2026 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

account Account issues, bugs and feature requests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants