fix(dns): store IDs immediately after provisioning (#1022)

relates to STACKITTPR-373
This commit is contained in:
Ruben Hönle 2025-10-15 11:16:30 +02:00 committed by GitHub
parent f0433984f4
commit 4103c33fd2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 133 additions and 18 deletions

View file

@ -7,6 +7,8 @@ import (
"regexp"
"strings"
"github.com/hashicorp/terraform-plugin-framework/tfsdk"
"github.com/hashicorp/terraform-plugin-framework/attr"
"github.com/hashicorp/terraform-plugin-framework/diag"
"github.com/hashicorp/terraform-plugin-framework/path"
@ -186,3 +188,11 @@ func CheckListRemoval(ctx context.Context, configModelList, planModelList types.
}
}
}
// SetAndLogStateFields writes the given map of key-value pairs to the state
func SetAndLogStateFields(ctx context.Context, diags *diag.Diagnostics, state *tfsdk.State, values map[string]any) {
for key, val := range values {
ctx = tflog.SetField(ctx, key, val)
diags.Append(state.SetAttribute(ctx, path.Root(key), val)...)
}
}