Documentation
¶
Overview ¶
Package projectscope owns the policy for which Kernel project a single operation targets. An explicit attribute value wins, then the provider-level default. Empty means unscoped: no project header is sent and the API key's binding decides the project.
Resolve is for operations driven by configuration (resource Create, data source Read). Operations on existing resources (Read, Update, Delete) must use the project recorded in state instead, so a later change to the provider default never re-points them at a different project.
Index ¶
- func AddError(diags *diag.Diagnostics, operation, projectID string, err error)
- func IsNotFound(err error) bool
- func Resolve(attribute types.String, defaultProjectID string) string
- func ResolveDataSource(diags *diag.Diagnostics, attribute types.String, defaultProjectID string) string
- func StateValue(projectID string) types.String
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddError ¶
func AddError(diags *diag.Diagnostics, operation, projectID string, err error)
AddError records err for a project-scoped operation. On calls that explicitly targeted a project, a 403 becomes a project-access diagnostic and a project_not_found 404 becomes a project diagnostic, both on project_id; every other error keeps its raw text under the operation name.
func IsNotFound ¶
IsNotFound reports whether err is the API's coded resource-not-found response. A 404 without code "not_found" — such as the middleware's project_not_found for a missing or suspended project — does not mean the resource is gone and must not remove it from state.
func Resolve ¶
Resolve returns the project for a config-driven operation: the attribute value when set, otherwise the provider-level default. Unknown must fall back to the default, not error: an Optional+Computed resource attribute left unset arrives at apply time as unknown.
func ResolveDataSource ¶
func ResolveDataSource(diags *diag.Diagnostics, attribute types.String, defaultProjectID string) string
ResolveDataSource resolves the project for a data source read. Terraform normally defers data source reads until the configuration is wholly known, but the framework documents that Config may still carry unknown values; an unknown project must error rather than silently read the provider default.
func StateValue ¶
StateValue converts a resolved project into its state representation: null when unscoped, so reads stay with the API key's binding.
Types ¶
This section is empty.