@@ -2,7 +2,6 @@ package analyser
22
33import (
44 "encoding/json"
5- "fmt"
65 "sort"
76 "strings"
87 "time"
@@ -58,13 +57,6 @@ type serializableAnalysis struct {
5857 Alerts map [string ][]alerter.SerializableAlert `json:"alerts"`
5958}
6059
61- type GenDriftIgnoreOptions struct {
62- ExcludeUnmanaged bool
63- ExcludeDeleted bool
64- ExcludeDrifted bool
65- InputPath string
66- }
67-
6860func (a Analysis ) MarshalJSON () ([]byte , error ) {
6961 bla := serializableAnalysis {}
7062 for _ , m := range a .managed {
@@ -209,40 +201,6 @@ func (a *Analysis) SortResources() {
209201 a .differences = SortDifferences (a .differences )
210202}
211203
212- func (a * Analysis ) DriftIgnoreList (opts GenDriftIgnoreOptions ) (int , string ) {
213- var list []string
214-
215- resourceCount := 0
216-
217- addResources := func (res ... resource.Resource ) {
218- for _ , r := range res {
219- list = append (list , fmt .Sprintf ("%s.%s" , r .TerraformType (), escapeKey (r .TerraformId ())))
220- }
221- resourceCount += len (res )
222- }
223- addDifferences := func (diff ... Difference ) {
224- for _ , d := range diff {
225- addResources (d .Res )
226- }
227- resourceCount += len (diff )
228- }
229-
230- if ! opts .ExcludeUnmanaged && a .Summary ().TotalUnmanaged > 0 {
231- list = append (list , "# Resources not covered by IaC" )
232- addResources (a .Unmanaged ()... )
233- }
234- if ! opts .ExcludeDeleted && a .Summary ().TotalDeleted > 0 {
235- list = append (list , "# Missing resources" )
236- addResources (a .Deleted ()... )
237- }
238- if ! opts .ExcludeDrifted && a .Summary ().TotalDrifted > 0 {
239- list = append (list , "# Changed resources" )
240- addDifferences (a .Differences ()... )
241- }
242-
243- return resourceCount , strings .Join (list , "\n " )
244- }
245-
246204func SortDifferences (diffs []Difference ) []Difference {
247205 sort .SliceStable (diffs , func (i , j int ) bool {
248206 if diffs [i ].Res .TerraformType () != diffs [j ].Res .TerraformType () {
@@ -264,10 +222,3 @@ func SortChanges(changes []Change) []Change {
264222 })
265223 return changes
266224}
267-
268- func escapeKey (line string ) string {
269- line = strings .ReplaceAll (line , `\` , `\\` )
270- line = strings .ReplaceAll (line , `.` , `\.` )
271-
272- return line
273- }
0 commit comments