You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: refresh entitlements after license create/delete (#306)
## Problem
When deploying a `coderd_workspace_proxy` (or other entitlement-gated
resource) immediately after `coderd_license` in the same `terraform
apply`, the proxy creation fails with:
```
Error: Feature not enabled
Your license is not entitled to create workspace proxies.
```
This happens because the provider fetches entitlements once during
`Configure()` (before any resources are created) and never refreshes
them. After `coderd_license` adds the license to the server, subsequent
resources still see the stale pre-license feature flags.
## Fix
After `LicenseResource.Create()` and `.Delete()` succeed, re-fetch
deployment entitlements and update the shared
`CoderdProviderData.Features` map. Since all resources share the same
pointer, they immediately see up-to-date entitlements.
The refresh is best-effort: if re-fetching entitlements fails, a warning
is emitted but the license operation itself still succeeds.
## Regression test
Adds `TestAccWorkspaceProxyResourceAfterLicenseInSameApply` which starts
an unlicensed Coder instance and applies a config that creates both
`coderd_license` and `coderd_workspace_proxy` (with `depends_on`) in a
single step — the exact scenario from the bug report.
Closes#303
0 commit comments