forked from fugue/regula
-
Notifications
You must be signed in to change notification settings - Fork 0
/
terraform.patch
109 lines (107 loc) · 3.3 KB
/
terraform.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
diff --git a/pkg/terraform/configs/configload/loader_snapshot.go b/pkg/terraform/configs/configload/loader_snapshot.go
index 243939f..6ca8b4f 100644
--- a/pkg/terraform/configs/configload/loader_snapshot.go
+++ b/pkg/terraform/configs/configload/loader_snapshot.go
@@ -325,6 +325,10 @@ func (fs snapshotFS) Chmod(name string, mode os.FileMode) error {
return fmt.Errorf("cannot set file mode inside configuration snapshot")
}
+func (fs snapshotFS) Chown(string, int, int) error {
+ return fmt.Errorf("cannot set file owner inside configuration snapshot")
+}
+
func (fs snapshotFS) Chtimes(name string, atime, mtime time.Time) error {
return fmt.Errorf("cannot set file times inside configuration snapshot")
}
diff --git a/pkg/terraform/tfdiags/diagnostics.go b/pkg/terraform/tfdiags/diagnostics.go
index 30476ee..25cd135 100644
--- a/pkg/terraform/tfdiags/diagnostics.go
+++ b/pkg/terraform/tfdiags/diagnostics.go
@@ -107,24 +107,6 @@ func (diags Diagnostics) HasErrors() bool {
return false
}
-// ForRPC returns a version of the receiver that has been simplified so that
-// it is friendly to RPC protocols.
-//
-// Currently this means that it can be serialized with encoding/gob and
-// subsequently re-inflated. It may later grow to include other serialization
-// formats.
-//
-// Note that this loses information about the original objects used to
-// construct the diagnostics, so e.g. the errwrap API will not work as
-// expected on an error-wrapped Diagnostics that came from ForRPC.
-func (diags Diagnostics) ForRPC() Diagnostics {
- ret := make(Diagnostics, len(diags))
- for i := range diags {
- ret[i] = makeRPCFriendlyDiag(diags[i])
- }
- return ret
-}
-
// Err flattens a diagnostics list into a single Go error, or to nil
// if the diagnostics list does not include any error-level diagnostics.
//
diff --git a/pkg/terraform/tfdiags/rpc_friendly.go b/pkg/terraform/tfdiags/rpc_friendly.go
deleted file mode 100644
index 485063b..0000000
--- a/pkg/terraform/tfdiags/rpc_friendly.go
+++ /dev/null
@@ -1,59 +0,0 @@
-package tfdiags
-
-import (
- "encoding/gob"
-)
-
-type rpcFriendlyDiag struct {
- Severity_ Severity
- Summary_ string
- Detail_ string
- Subject_ *SourceRange
- Context_ *SourceRange
-}
-
-// rpcFriendlyDiag transforms a given diagnostic so that is more friendly to
-// RPC.
-//
-// In particular, it currently returns an object that can be serialized and
-// later re-inflated using gob. This definition may grow to include other
-// serializations later.
-func makeRPCFriendlyDiag(diag Diagnostic) Diagnostic {
- desc := diag.Description()
- source := diag.Source()
- return &rpcFriendlyDiag{
- Severity_: diag.Severity(),
- Summary_: desc.Summary,
- Detail_: desc.Detail,
- Subject_: source.Subject,
- Context_: source.Context,
- }
-}
-
-func (d *rpcFriendlyDiag) Severity() Severity {
- return d.Severity_
-}
-
-func (d *rpcFriendlyDiag) Description() Description {
- return Description{
- Summary: d.Summary_,
- Detail: d.Detail_,
- }
-}
-
-func (d *rpcFriendlyDiag) Source() Source {
- return Source{
- Subject: d.Subject_,
- Context: d.Context_,
- }
-}
-
-func (d rpcFriendlyDiag) FromExpr() *FromExpr {
- // RPC-friendly diagnostics cannot preserve expression information because
- // expressions themselves are not RPC-friendly.
- return nil
-}
-
-func init() {
- gob.Register((*rpcFriendlyDiag)(nil))
-}