Skip to content

Commit

Permalink
fix: missing provisioner uri in persisted resource state
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Meier <[email protected]>
  • Loading branch information
astromechza committed Mar 15, 2024
1 parent c3c6ec0 commit bf87309
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/provisioners/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ type NetworkService struct {

// ProvisionOutput is the output returned from a provisioner implementation.
type ProvisionOutput struct {
ProvisionerUri string `json:"-"`
ResourceState map[string]interface{} `json:"resource_state"`
ResourceOutputs map[string]interface{} `json:"resource_outputs"`
SharedState map[string]interface{} `json:"shared_state"`
Expand Down Expand Up @@ -145,6 +146,9 @@ func (po *ProvisionOutput) ApplyToStateAndProject(state *project.State, resUid p
return nil, fmt.Errorf("failed to apply to state - unknown res uid")
}

// Update the provisioner string
existing.ProvisionerUri = po.ProvisionerUri

// State must ALWAYS be updated. If we don't get state back, we assume it's now empty.
if po.ResourceState != nil {
existing.State = po.ResourceState
Expand Down Expand Up @@ -317,6 +321,7 @@ func ProvisionResources(ctx context.Context, state *project.State, provisioners
return nil, fmt.Errorf("resource '%s': failed to provision: %w", resUid, err)
}

output.ProvisionerUri = provisioner.Uri()
out, err = output.ApplyToStateAndProject(out, resUid, composeProject)
if err != nil {
return nil, fmt.Errorf("resource '%s': failed to apply outputs: %w", resUid, err)
Expand Down

0 comments on commit bf87309

Please sign in to comment.