fix: multiple fixes + pg-query e2e passed

upload.go:
- Update → Patch (MergeFrom) to avoid resourceVersion conflict when operator
  modifies Function between Get() and Update()

terraform provider v0.1.1:
- trigger_resource.go: trToModel returns StringNull() for empty schedule
  (fixes 'provider produced inconsistent result' for http triggers)
- main.go: bump version to 0.1.1

examples/pg-query:
- handler.py: fix column name started_at → created_at (matches migrations/001)
- main.tf: pin provider to ~> 0.1.1

.gitignore: add terraform state, lock, .terraform/, handler.zip

doc/errors/log.md: documented all 5 errors from this session:
- resourceVersion conflict → use Patch
- terraform inconsistent result for schedule → StringNull
- terraform import not implemented → delete+recreate workaround
- wrong column name → check migrations before writing handlers
- Deployment not restarting after image rebuild → rollout restart / TODO: restartedAt annotation

doc/progress.md: terraform apply e2e 
This commit is contained in:
“Naeel”
2026-03-07 10:52:29 +04:00
parent 4e59d79884
commit 0268ef0523
8 changed files with 120 additions and 10 deletions
@@ -172,13 +172,19 @@ func (r *TriggerResource) Delete(ctx context.Context, req resource.DeleteRequest
}
// trToModel конвертирует API-ответ → state модель.
// schedule: возвращаем Null если пустая строка — terraform требует null для Optional-полей,
// которые не заданы в конфиге (иначе план: null → apply: "" → "inconsistent result").
func trToModel(tr *client.TriggerResponse) TriggerModel {
schedule := types.StringNull()
if tr.Schedule != "" {
schedule = types.StringValue(tr.Schedule)
}
return TriggerModel{
Namespace: types.StringValue(tr.Namespace),
Name: types.StringValue(tr.Name),
Type: types.StringValue(tr.Type),
FunctionRef: types.StringValue(tr.FunctionRef),
Schedule: types.StringValue(tr.Schedule),
Schedule: schedule,
Active: types.BoolValue(tr.Active),
URL: types.StringValue(tr.URL),
}
+2 -2
View File
@@ -12,8 +12,8 @@ import (
"github.com/hashicorp/terraform-plugin-framework/providerserver"
)
// version задаётся ldflags при сборке: -ldflags "-X main.version=0.1.0"
var version string = "0.1.0"
// version задаётся ldflags при сборке: -ldflags "-X main.version=0.1.1"
var version string = "0.1.1"
func main() {
opts := providerserver.ServeOpts{