Skip to content
This repository has been archived by the owner on Jun 4, 2024. It is now read-only.

Commit

Permalink
terraform: access list support
Browse files Browse the repository at this point in the history
This PR adds access list support to the Terraform provider. Since we
stopped using gogoproto, generating new resources became increasingly
complex.

The access list terraform schema was generated from the protobuf types
and not the ones in `api/types`, which causes all kind of small oddities
from a user PoV, and made this PR way more complex.

User-facing limitations:
- the `metadata` field is nested under the `header` one because of the
  protobuf structure
- the traits is not a map but a list of structs, each struct with a key
  and a value attribute

Non user-facing limitations the PR had to work around:
- the protobuf time is different from go's time, I initially wanted to
  create `ProtoTimeType`/`ProtoTimeValue` but we cannot embbed a
  protobuf timestamp directly (because it contains a lock, the terraform
  value must be a reference, which is not supported by the protoc
  generator). The workaround is to use custom types (`Timestamp` and
  `Duration`).
- the provider has to do the conversion between the proto type and the
  api/type. This required writing a new provider template for new
  non-gogo resources (`gen/plural_data_source_new.go.tpl` and
  `gen/plural_resources_new.go.tpl`)
- The time type difference caused conversion issues fixed by
  gravitational/teleport#32135
  • Loading branch information
hugoShaka committed Sep 19, 2023
1 parent 948585e commit 5d918fb
Show file tree
Hide file tree
Showing 22 changed files with 4,840 additions and 233 deletions.
51 changes: 23 additions & 28 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ go 1.19
require (
github.com/DanielTitkov/go-adaptive-cards v0.2.2
github.com/alecthomas/kong v0.2.22
github.com/go-resty/resty/v2 v2.7.0 // indirect
github.com/go-resty/resty/v2 v2.8.0 // indirect
github.com/gogo/protobuf v1.3.2
github.com/google/uuid v1.3.0
github.com/google/uuid v1.3.1
github.com/gravitational/kingpin v2.1.11-0.20220901134012-2a1956e29525+incompatible
github.com/gravitational/teleport v0.0.0 // replaced
github.com/gravitational/teleport/api v0.0.0 // replaced
github.com/gravitational/trace v1.2.1
github.com/gravitational/trace v1.3.1
github.com/hashicorp/terraform-plugin-framework v0.10.0
github.com/hashicorp/terraform-plugin-go v0.12.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.10.1
Expand All @@ -27,17 +27,15 @@ require (
github.com/sirupsen/logrus v1.9.3
github.com/stretchr/testify v1.8.4
github.com/tidwall/gjson v1.14.4
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df
golang.org/x/net v0.14.0
golang.org/x/exp v0.0.0-20230811145659-89c5cff77bcb
golang.org/x/net v0.15.0
golang.org/x/sync v0.3.0
google.golang.org/grpc v1.56.2
google.golang.org/grpc v1.58.1
google.golang.org/protobuf v1.31.0
gopkg.in/mail.v2 v2.3.1
)

require (
cloud.google.com/go v0.110.2 // indirect
cloud.google.com/go/compute v1.22.0 // indirect
github.com/agext/levenshtein v1.2.3 // indirect
github.com/alecthomas/assert v1.0.0 // indirect
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect
Expand All @@ -59,7 +57,6 @@ require (
github.com/google/btree v1.1.2 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/googleapis/gax-go/v2 v2.11.0 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
Expand Down Expand Up @@ -108,36 +105,34 @@ require (
github.com/vmihailenco/msgpack/v4 v4.3.12 // indirect
github.com/vmihailenco/tagparser v0.1.2 // indirect
github.com/zclconf/go-cty v1.12.1 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.42.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.42.0 // indirect
go.opentelemetry.io/otel v1.16.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.16.0 // indirect
go.opentelemetry.io/otel/metric v1.16.0 // indirect
go.opentelemetry.io/otel/sdk v1.16.0 // indirect
go.opentelemetry.io/otel/trace v1.16.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.44.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.44.0 // indirect
go.opentelemetry.io/otel v1.18.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.18.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.18.0 // indirect
go.opentelemetry.io/otel/metric v1.18.0 // indirect
go.opentelemetry.io/otel/sdk v1.18.0 // indirect
go.opentelemetry.io/otel/trace v1.18.0 // indirect
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
golang.org/x/crypto v0.12.0 // indirect
golang.org/x/sys v0.11.0 // indirect
golang.org/x/term v0.11.0 // indirect
golang.org/x/text v0.12.0 // indirect
google.golang.org/api v0.126.0 // indirect
golang.org/x/crypto v0.13.0 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/term v0.12.0 // indirect
golang.org/x/text v0.13.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230706204954-ccb25ca9f130 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230803162519-f966b187b2e5 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230911183012-2d3300fd4832 // indirect
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apimachinery v0.27.4 // indirect
k8s.io/apimachinery v0.28.2 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)

replace (
github.com/gogo/protobuf => github.com/gravitational/protobuf v1.3.2-0.20201123192827-2b9fcfaffcbf
github.com/gravitational/teleport => github.com/gravitational/teleport v0.0.0-20230905183941-c95e235e8855 // ref: tags/v13.3.8
github.com/gravitational/teleport/api => github.com/gravitational/teleport/api v0.0.0-20230905183941-c95e235e8855 // ref: tags/v13.3.8
github.com/gravitational/teleport => github.com/gravitational/teleport v0.0.0-20230919154258-e1358b45ad71 // ref: heads/hugo/fix-header-time-conversion-pt2
github.com/gravitational/teleport/api => github.com/gravitational/teleport/api v0.0.0-20230919154258-e1358b45ad71 // ref: heads/hugo/fix-header-time-conversion-pt2
github.com/julienschmidt/httprouter => github.com/rw-access/httprouter v1.3.1-0.20210321233808-98e93175c124
github.com/microsoft/go-mssqldb => github.com/gravitational/go-mssqldb v0.11.1-0.20230331180905-0f76f1751cd3
)
Loading

0 comments on commit 5d918fb

Please sign in to comment.