Skip to content

Remove project override#384

Merged
stgraber merged 2 commits intomainfrom
default-project
Feb 13, 2026
Merged

Remove project override#384
stgraber merged 2 commits intomainfrom
default-project

Conversation

@maveonair
Copy link
Member

@maveonair maveonair commented Feb 4, 2026

As discussed in this PR, we have decided to remove project overwriting in the provider configuration. If we want to do this correctly, we would need to rework the provider. And we believe that it is a better API if the change to the default project is instead defined explicitly in the resources.

@stgraber
Copy link
Member

stgraber commented Feb 4, 2026

Storage pools are a global resource so they can't be tied to a project.

The bucket keys are a nested resource under a storage bucket which does have a project field.

@maveonair
Copy link
Member Author

I start to realize that we have the project as an attribute for resources who actually are not tight to a project. Should we remove this then?

@stgraber
Copy link
Member

stgraber commented Feb 4, 2026

I start to realize that we have the project as an attribute for resources who actually are not tight to a project. Should we remove this then?

Yeah, that's probably the better approach.
If something has a parent that's tied to a project, it shouldn't really have a project field of its own.

@maveonair maveonair force-pushed the default-project branch 4 times, most recently from c1b6e7f to f68cb34 Compare February 7, 2026 09:31
@stgraber
Copy link
Member

stgraber commented Feb 7, 2026

Tests seem unhappy :)

@maveonair
Copy link
Member Author

@stgraber I realized this change is more complex than expected. Today we rely on Incus to implicitly use the default project when the provider passes null. If project is set in the provider, it should override this behavior globally. My change does that, but it exposes a problem: once the provider always records a project in the Terraform state, we can no longer rely on the Incus server to infer the default. Setting project = null also does not force recreation, because the attribute is now marked as computed and Terraform always keeps the value returned by the server.

This leads to another problem too. If the project is set in the provider after resources already exist, resources without an explicit project will not be recreated, even though their effective project has changed.

That leaves us with two options:

  1. Rework the provider so it fully owns project defaulting, and changing the provider project forces recreation of all resources without an explicit project, as this enforces consistency.
  2. Remove the project attribute from the provider entirely.

I lean toward option 2. I prefer explicit behavior: if a specific project is desired, it should be set explicitly on the resource.

What do you think?

@stgraber
Copy link
Member

stgraber commented Feb 9, 2026

Yeah, 2) seems like the way to go.

@maveonair maveonair changed the title Ensure default project is used Remove project override Feb 10, 2026
@maveonair maveonair force-pushed the default-project branch 2 times, most recently from 1f636e0 to 4758b5a Compare February 11, 2026 06:50
@maveonair maveonair requested a review from stgraber February 11, 2026 06:54
@maveonair
Copy link
Member Author

@stgraber it looks like there is an issue with goreleaser now, which also affects the other PR created yesterday. Do you have already an idea how to fix it?

@jasisk
Copy link
Contributor

jasisk commented Feb 13, 2026

it looks like there is an issue with goreleaser now, which also affects the other PR created yesterday. Do you have already an idea how to fix it?

Current Go stable (1.26) removed the win32 arm target completely (release notes) so I imagine it'll have to be added to the ignore list moving forward. Would open a PR myself but not sure what you want to do with oldstable.

Decided to just open the PR in case it's the direction you want to go in.

Signed-off-by: Fabian Mettler <fabian@mettler.cc>
Signed-off-by: Fabian Mettler <fabian@mettler.cc>
@stgraber stgraber enabled auto-merge February 13, 2026 07:37
@stgraber stgraber merged commit 2f26e44 into main Feb 13, 2026
10 checks passed
@maveonair maveonair deleted the default-project branch February 13, 2026 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments