Skip to content

Commit

Permalink
remove deprecated etcd backend
Browse files Browse the repository at this point in the history
This allows us to remove the manual replace directives
github.com/dgrijalva/jwt-go and google.golang.org/grpc, so that we can
remove the CVE warnings and update the grpc packages.

While the etcdv3 backend is also marked as deprecated, the changes here
are done in a manner to keep that backend working for the time being.
  • Loading branch information
jbardin committed Jun 27, 2022
1 parent ec4935b commit 799ab6c
Show file tree
Hide file tree
Showing 13 changed files with 89 additions and 297 deletions.
29 changes: 12 additions & 17 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ require (
github.com/dylanmei/winrmtest v0.0.0-20210303004826-fbc9ae56efb6
github.com/go-test/deep v1.0.3
github.com/golang/mock v1.6.0
github.com/golang/protobuf v1.5.2
github.com/google/go-cmp v0.5.6
github.com/google/uuid v1.2.0
github.com/gophercloud/gophercloud v0.10.1-0.20200424014253-c3bfe50899e5
Expand Down Expand Up @@ -81,7 +80,8 @@ require (
github.com/zclconf/go-cty v1.10.0
github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b
github.com/zclconf/go-cty-yaml v1.0.2
go.etcd.io/etcd v0.5.0-alpha.5.0.20210428180535-15715dcf1ace
go.etcd.io/etcd/client/pkg/v3 v3.5.4
go.etcd.io/etcd/client/v3 v3.5.4
golang.org/x/crypto v0.0.0-20220518034528-6f7dac969898
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4
golang.org/x/net v0.0.0-20211216030914-fe4d6282115f
Expand All @@ -91,7 +91,7 @@ require (
golang.org/x/text v0.3.7
golang.org/x/tools v0.1.11
google.golang.org/api v0.44.0-impersonate-preview
google.golang.org/grpc v1.36.1
google.golang.org/grpc v1.47.0
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0
google.golang.org/protobuf v1.27.1
honnef.co/go/tools v0.3.0
Expand Down Expand Up @@ -126,8 +126,9 @@ require (
github.com/armon/go-radix v1.0.0 // indirect
github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f // indirect
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
github.com/coreos/go-semver v0.2.0 // indirect
github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d // indirect
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
github.com/creack/pty v1.1.18 // indirect
github.com/dimchansky/utfbom v1.1.1 // indirect
github.com/dylanmei/iso8601 v0.1.0 // indirect
Expand All @@ -137,6 +138,7 @@ require (
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.2.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/googleapis/gax-go/v2 v2.0.5 // indirect
Expand Down Expand Up @@ -174,16 +176,17 @@ require (
github.com/ulikunitz/xz v0.5.8 // indirect
github.com/vmihailenco/msgpack/v4 v4.3.12 // indirect
github.com/vmihailenco/tagparser v0.1.1 // indirect
go.etcd.io/etcd/api/v3 v3.5.4 // indirect
go.opencensus.io v0.23.0 // indirect
go.uber.org/atomic v1.3.2 // indirect
go.uber.org/multierr v1.1.0 // indirect
go.uber.org/zap v1.10.0 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.17.0 // indirect
golang.org/x/exp/typeparams v0.0.0-20220218215828-6cf2b201936e // indirect
golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5 // indirect
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect
golang.org/x/time v0.0.0-20220224211638-0e9765cccd65 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1 // indirect
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.66.2 // indirect
Expand All @@ -196,14 +199,6 @@ require (
sigs.k8s.io/yaml v1.2.0 // indirect
)

replace google.golang.org/grpc v1.36.1 => google.golang.org/grpc v1.27.1

replace github.com/golang/mock v1.5.0 => github.com/golang/mock v1.4.4

// github.com/dgrijalva/jwt-go is no longer maintained but is an indirect
// dependency of the old etcdv2 backend, and so we need to keep this working
// until that backend is removed. github.com/golang-jwt/jwt/v3 is a drop-in
// replacement that includes a fix for CVE-2020-26160.
replace github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt v3.2.1+incompatible

go 1.18
137 changes: 71 additions & 66 deletions go.sum

Large diffs are not rendered by default.

7 changes: 0 additions & 7 deletions internal/backend/init/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
backendAzure "github.com/hashicorp/terraform/internal/backend/remote-state/azure"
backendConsul "github.com/hashicorp/terraform/internal/backend/remote-state/consul"
backendCos "github.com/hashicorp/terraform/internal/backend/remote-state/cos"
backendEtcdv2 "github.com/hashicorp/terraform/internal/backend/remote-state/etcdv2"
backendEtcdv3 "github.com/hashicorp/terraform/internal/backend/remote-state/etcdv3"
backendGCS "github.com/hashicorp/terraform/internal/backend/remote-state/gcs"
backendHTTP "github.com/hashicorp/terraform/internal/backend/remote-state/http"
Expand Down Expand Up @@ -83,12 +82,6 @@ func Init(services *disco.Disco) {
`Warning: "artifactory" backend is deprecated, and will be removed in a future release."`,
)
},
"etcd": func() backend.Backend {
return deprecateBackend(
backendEtcdv2.New(),
`Warning: "etcd" backend is deprecated, and will be removed in a future release."`,
)
},
"etcdv3": func() backend.Backend {
return deprecateBackend(
backendEtcdv3.New(),
Expand Down
1 change: 0 additions & 1 deletion internal/backend/init/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ func TestInit_backend(t *testing.T) {

{"azure", "init.deprecatedBackendShim"},
{"artifactory", "init.deprecatedBackendShim"},
{"etcd", "init.deprecatedBackendShim"},
{"etcdv3", "init.deprecatedBackendShim"},
{"manta", "init.deprecatedBackendShim"},
{"swift", "init.deprecatedBackendShim"},
Expand Down
96 changes: 0 additions & 96 deletions internal/backend/remote-state/etcdv2/backend.go

This file was deleted.

11 changes: 0 additions & 11 deletions internal/backend/remote-state/etcdv2/backend_test.go

This file was deleted.

46 changes: 0 additions & 46 deletions internal/backend/remote-state/etcdv2/client.go

This file was deleted.

45 changes: 0 additions & 45 deletions internal/backend/remote-state/etcdv2/client_test.go

This file was deleted.

4 changes: 2 additions & 2 deletions internal/backend/remote-state/etcdv3/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (

"github.com/hashicorp/terraform/internal/backend"
"github.com/hashicorp/terraform/internal/legacy/helper/schema"
etcdv3 "go.etcd.io/etcd/clientv3"
"go.etcd.io/etcd/pkg/transport"
"go.etcd.io/etcd/client/pkg/v3/transport"
etcdv3 "go.etcd.io/etcd/client/v3"
)

const (
Expand Down
3 changes: 1 addition & 2 deletions internal/backend/remote-state/etcdv3/backend_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ import (
"sort"
"strings"

etcdv3 "go.etcd.io/etcd/clientv3"

"github.com/hashicorp/terraform/internal/backend"
"github.com/hashicorp/terraform/internal/states"
"github.com/hashicorp/terraform/internal/states/remote"
"github.com/hashicorp/terraform/internal/states/statemgr"
etcdv3 "go.etcd.io/etcd/client/v3"
)

func (b *Backend) Workspaces() ([]string, error) {
Expand Down
2 changes: 1 addition & 1 deletion internal/backend/remote-state/etcdv3/backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"time"

"github.com/hashicorp/terraform/internal/backend"
etcdv3 "go.etcd.io/etcd/clientv3"
etcdv3 "go.etcd.io/etcd/client/v3"
)

var (
Expand Down
4 changes: 2 additions & 2 deletions internal/backend/remote-state/etcdv3/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"github.com/hashicorp/go-multierror"
"github.com/hashicorp/terraform/internal/states/remote"
"github.com/hashicorp/terraform/internal/states/statemgr"
etcdv3 "go.etcd.io/etcd/clientv3"
etcdv3sync "go.etcd.io/etcd/clientv3/concurrency"
etcdv3 "go.etcd.io/etcd/client/v3"
etcdv3sync "go.etcd.io/etcd/client/v3/concurrency"
)

const (
Expand Down
1 change: 0 additions & 1 deletion tools/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package tools

import (
_ "github.com/golang/mock/mockgen"
_ "github.com/golang/protobuf/protoc-gen-go"
_ "github.com/mitchellh/gox"
_ "github.com/nishanths/exhaustive"
_ "golang.org/x/tools/cmd/cover"
Expand Down

0 comments on commit 799ab6c

Please sign in to comment.