Skip to content

Commit c0e1dff

Browse files
authored
Merge pull request #502 from cloudskiff/revert-feat/genDriftIgnore
Remove gen-driftignore feature from v0.8.0
2 parents be99ab0 + f52c6c7 commit c0e1dff

11 files changed

Lines changed: 0 additions & 422 deletions

pkg/analyser/analysis.go

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package analyser
22

33
import (
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-
6860
func (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-
246204
func 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-
}

pkg/cmd/driftctl.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ func NewDriftctlCmd(build build.BuildInterface) *DriftctlCmd {
6666
cmd.PersistentFlags().BoolP("send-crash-report", "", false, "Enable error reporting. Crash data will be sent to us via Sentry.\nWARNING: may leak sensitive data (please read the documentation for more details)\nThis flag should be used only if an error occurs during execution")
6767

6868
cmd.AddCommand(NewScanCmd())
69-
cmd.AddCommand(NewGenDriftIgnoreCmd())
7069

7170
return cmd
7271
}

pkg/cmd/gen_driftignore.go

Lines changed: 0 additions & 58 deletions
This file was deleted.

pkg/cmd/gen_driftignore_test.go

Lines changed: 0 additions & 152 deletions
This file was deleted.

pkg/cmd/testdata/input_stdin_empty.json

Lines changed: 0 additions & 15 deletions
This file was deleted.

pkg/cmd/testdata/input_stdin_invalid.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)