public PlanResourceChangeResult <FileResource> PlanChange( PlanResourceChangeInput <FileResource> input) { _log.LogDebug("{method}: ", nameof(PlanChange)); _log.LogTrace("->input = {@input}", input); _log.LogDebug(" Config: " + JsonConvert.SerializeObject(input.Config, Formatting.Indented)); _log.LogDebug(" Prior: " + JsonConvert.SerializeObject(input.PriorState, Formatting.Indented)); _log.LogDebug("Proposed: " + JsonConvert.SerializeObject(input.ProposedNewState, Formatting.Indented)); var result = new PlanResourceChangeResult <FileResource>(); if (input.ChangeType == ResourceChangeType.Update) { result.RequiresReplace = ResolveRequiresReplace(input.PriorState, input.Config); } result.PlannedState = new FileResource().CopyArgumentsFrom(input.Config); var newContent = input.ChangeType == ResourceChangeType.Create || (input.ChangeType == ResourceChangeType.Update && (input.Config.Path != input.PriorState?.Path || input.Config.SourceOfContent != input.PriorState?.SourceOfContent)); if (!newContent) { result.PlannedState.FullPath = input.PriorState.FullPath; result.PlannedState.LastModified = input.PriorState.LastModified; } // If a checksum was requested, we indicate that the corresponding // checksum value property will be computed after the apply using null if (input.ChangeType != ResourceChangeType.Delete && !string.IsNullOrEmpty(input.Config.ComputeChecksum)) { if (newContent || input.Config.ComputeChecksum != input.PriorState.ComputeChecksum) { _log.LogDebug("Reseting Checksum, to be computed ({prior} -> {config})", input.PriorState?.ComputeChecksum, input.Config?.ComputeChecksum); result.PlannedState.Checksum = null; } else { _log.LogDebug("Keeping Checksum"); result.PlannedState.Checksum = input.PriorState.Checksum; } } _log.LogTrace("<-result = {@result}", result); return(result); }
public PlanResourceChangeResult <RegistryKeyResource> PlanChange( PlanResourceChangeInput <RegistryKeyResource> input) { _log.LogDebug("{method}: ", nameof(PlanChange)); _log.LogTrace("->input = {@input}", input); _log.LogDebug(" * .....Config: " + JsonConvert.SerializeObject(input.Config, Formatting.Indented)); _log.LogDebug(" * ......Prior: " + JsonConvert.SerializeObject(input.PriorState, Formatting.Indented)); _log.LogDebug(" * ...Proposed: " + JsonConvert.SerializeObject(input.ProposedNewState, Formatting.Indented)); var result = new PlanResourceChangeResult <RegistryKeyResource>(); var replace = new TFAttributePaths(); result.RequiresReplace = ResolveRequiresReplace(input.PriorState, input.Config); result.PlannedState = input.ProposedNewState; result.PlannedPrivate = input.PriorPrivate; _log.LogTrace("<-result = {@result}", result); return(result); }