fix(engine-b): idempotent local DNS record (firstOrCreate on record_id)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>feat/portal-design
parent
96aceeeaa1
commit
d7c2edb1df
|
|
@ -31,13 +31,14 @@ class ConfigureDnsAndTls extends CustomerStep
|
|||
$host = $instance->host;
|
||||
$fqdn = $instance->subdomain.'.'.config('provisioning.dns.zone');
|
||||
|
||||
// DNS — persist the record id [E] before anything downstream.
|
||||
// DNS — provider upsert is idempotent; the local row uses firstOrCreate on
|
||||
// the record id and is written BEFORE the breadcrumb (the short-circuit guard).
|
||||
if (! $this->hasResource($run, 'dns_record_id')) {
|
||||
$recordId = $this->dns->upsertRecord($fqdn, 'A', $host->public_ip);
|
||||
$instance->dnsRecords()->create([
|
||||
'provider' => 'hetzner', 'record_id' => $recordId,
|
||||
'fqdn' => $fqdn, 'type' => 'A', 'value' => $host->public_ip,
|
||||
]);
|
||||
$instance->dnsRecords()->firstOrCreate(
|
||||
['record_id' => $recordId],
|
||||
['provider' => 'hetzner', 'fqdn' => $fqdn, 'type' => 'A', 'value' => $host->public_ip],
|
||||
);
|
||||
$this->recordResource($run, $host, 'dns_record_id', $recordId);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue