Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ jobs:
- name: Check if Terraform resources are up to date
# We have to add the current directory as a safe directory or else git commands will not work as expected.
# The protoc-gen-terraform version must match the version in integrations/terraform/Makefile
run: git config --global --add safe.directory $(realpath .) && go install github.com/gravitational/protoc-gen-terraform/v4@v4.0.0 && make terraform-resources-up-to-date
run: git config --global --add safe.directory $(realpath .) && make terraform-resources-up-to-date

- name: Check if Terraform module reference docs are up to date
# We have to add the current directory as a safe directory or else git commands will not work as expected.
Expand Down
12 changes: 2 additions & 10 deletions integrations/terraform/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
include install.mk

LOCALDIR := $(dir $(CURDIR)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))
PROTOC_GEN_TERRAFORM:= $(shell command -v protoc-gen-terraform)
CURRENT_DIR := $(shell pwd)
PROTOC_GEN_TERRAFORM:= "protoc-gen-terraform=$(CURRENT_DIR)/protoc-gen-terraform.sh"

BUILDDIR ?= build
TFDIR ?= example
Expand Down Expand Up @@ -63,17 +64,8 @@ $(BUILDDIR)/terraform-provider-teleport_%: terraform-provider-teleport-v$(VERSIO
mv $(BUILDDIR)/$(OS)/$*/terraform-provider-teleport $@

CUSTOM_IMPORTS_TMP_DIR ?= /tmp/protoc-gen-terraform/custom-imports
# This version must match the version installed by .github/workflows/lint.yaml
PROTOC_GEN_TERRAFORM_VERSION ?= v4.0.0
PROTOC_GEN_TERRAFORM_EXISTS := $(shell $(PROTOC_GEN_TERRAFORM) version 2>&1 >/dev/null | grep 'protoc-gen-terraform $(PROTOC_GEN_TERRAFORM_VERSION)')

.PHONY: gen-tfschema
gen-tfschema:
ifndef PROTOC_GEN_TERRAFORM_EXISTS
@echo "protoc-gen-terraform $(PROTOC_GEN_TERRAFORM_VERSION) is not installed. Please, refer to README.md for installation instructions."
@exit -1
endif

# The wrappers.proto file needed for this generator exist only inside the go mod cache,
# so we retrieve the file path for the cached proto files with go mod tools.
$(eval PROTOBUF_MOD_PATH := $(shell go list -m -u -f '{{.Dir}}' github.com/gogo/protobuf))
Expand Down
12 changes: 4 additions & 8 deletions integrations/terraform/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,22 @@ Please refer to the [official documentation](https://goteleport.com/docs/referen
## Development

1. Install [`protobuf`](https://grpc.io/docs/protoc-installation/).
2. Install [`protoc-gen-terraform`](https://github.com/gravitational/protoc-gen-terraform) @v4.0.0.
2. Install [`Terraform`](https://learn.hashicorp.com/tutorials/terraform/install-cli) v1.1.0+. Alternatively, you can use [`tfenv`](https://github.com/tfutils/tfenv). Please note that on Mac M1 you need to specify `TFENV_ARCH` (ex: `TFENV_ARCH=arm64 tfenv install 1.1.6`).

```go install github.com/gravitational/protoc-gen-terraform/v4@v4.0.0```

3. Install [`Terraform`](https://learn.hashicorp.com/tutorials/terraform/install-cli) v1.1.0+. Alternatively, you can use [`tfenv`](https://github.com/tfutils/tfenv). Please note that on Mac M1 you need to specify `TFENV_ARCH` (ex: `TFENV_ARCH=arm64 tfenv install 1.1.6`).

4. Build and install the plugin:
3. Build and install the plugin:

```bash
cd integrations/terraform
make install
```

5. Run tests:
4. Run tests:

```bash
make test
```

6. For provider architecture and resource development, see:
5. For provider architecture and resource development, see:

- [Architecture](./ARCHITECTURE.md)
- [Contributing resources](./CONTRIBUTING.md)
Expand Down
30 changes: 18 additions & 12 deletions integrations/terraform/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ require (
github.com/Masterminds/sprig/v3 v3.3.0 // indirect
github.com/Masterminds/squirrel v1.5.4 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/ProtonMail/go-crypto v1.1.6 // indirect
github.com/ProtonMail/go-crypto v1.3.0 // indirect
github.com/ThalesIgnite/crypto11 v1.2.5 // indirect
github.com/agext/levenshtein v1.2.2 // indirect
github.com/alecthomas/kingpin/v2 v2.4.0 // indirect
Expand Down Expand Up @@ -168,6 +168,7 @@ require (
github.com/cyberphone/json-canonicalization v0.0.0-20241213102144-19d51d7fe467 // indirect
github.com/cyphar/filepath-securejoin v0.7.0 // indirect
github.com/datastax/go-cassandra-native-protocol v0.0.0-20220706104457-5e8aad05cf90 // indirect
github.com/dave/jennifer v1.4.1 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/di-wu/parser v0.3.0 // indirect
Expand Down Expand Up @@ -266,30 +267,31 @@ require (
github.com/grafana/pyroscope-go v1.2.7 // indirect
github.com/grafana/pyroscope-go/godeltaprof v0.1.9 // indirect
github.com/gravitational/license v0.0.0-20250329001817-070456fa8ec1 // indirect
github.com/gravitational/protoc-gen-terraform/v4 v4.0.0 // indirect
github.com/gravitational/roundtrip v1.0.3 // indirect
github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.1.0 // indirect
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.3 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0 // indirect
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed // indirect
github.com/hashicorp/cli v1.1.6 // indirect
github.com/hashicorp/cli v1.1.7 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect
github.com/hashicorp/go-cty v1.5.0 // indirect
github.com/hashicorp/go-hclog v1.6.3 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-plugin v1.4.10 // indirect
github.com/hashicorp/go-plugin v1.7.0 // indirect
github.com/hashicorp/go-retryablehttp v0.7.8 // indirect
github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/hashicorp/go-version v1.7.0 // indirect
github.com/hashicorp/go-version v1.8.0 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/hashicorp/hc-install v0.7.0 // indirect
github.com/hashicorp/hc-install v0.9.3 // indirect
github.com/hashicorp/hcl/v2 v2.24.0 // indirect
github.com/hashicorp/logutils v1.0.0 // indirect
github.com/hashicorp/terraform-exec v0.21.0 // indirect
github.com/hashicorp/terraform-json v0.22.1 // indirect
github.com/hashicorp/terraform-exec v0.25.0 // indirect
github.com/hashicorp/terraform-json v0.27.2 // indirect
github.com/hashicorp/terraform-plugin-docs v0.0.0-00010101000000-000000000000 // indirect
github.com/hashicorp/terraform-registry-address v0.2.1 // indirect
github.com/hashicorp/terraform-registry-address v0.4.0 // indirect
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
github.com/hashicorp/yamux v0.1.2 // indirect
github.com/hinshun/vt10x v0.0.0-20220301184237-5011da428d02 // indirect
Expand Down Expand Up @@ -351,7 +353,7 @@ require (
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/ncruces/go-strftime v1.0.0 // indirect
github.com/ohler55/ojg v1.27.0 // indirect
github.com/oklog/run v1.0.0 // indirect
github.com/oklog/run v1.1.0 // indirect
github.com/oklog/ulid/v2 v2.1.1 // indirect
github.com/okta/okta-sdk-golang/v2 v2.20.0 // indirect
github.com/openai/openai-go/v3 v3.8.1 // indirect
Expand Down Expand Up @@ -415,6 +417,7 @@ require (
github.com/spf13/cobra v1.10.2 // indirect
github.com/spf13/pflag v1.0.10 // indirect
github.com/spiffe/go-spiffe/v2 v2.6.0 // indirect
github.com/stoewer/go-strcase v1.3.0 // indirect
github.com/stretchr/objx v0.5.3 // indirect
github.com/thales-e-security/pool v0.0.2 // indirect
github.com/theupdateframework/go-tuf/v2 v2.4.2-0.20260407074541-7e8f69f906ef // indirect
Expand All @@ -425,7 +428,7 @@ require (
github.com/transparency-dev/formats v0.1.1 // indirect
github.com/transparency-dev/merkle v0.0.2 // indirect
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/vulcand/predicate v1.2.0 // indirect
github.com/x448/float16 v0.8.4 // indirect
Expand All @@ -438,7 +441,7 @@ require (
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect
github.com/yuin/goldmark v1.7.17 // indirect
github.com/yuin/goldmark-meta v1.1.0 // indirect
github.com/zclconf/go-cty v1.16.3 // indirect
github.com/zclconf/go-cty v1.17.0 // indirect
github.com/zitadel/logging v0.6.2 // indirect
github.com/zitadel/oidc/v3 v3.45.0 // indirect
github.com/zitadel/schema v1.3.1 // indirect
Expand Down Expand Up @@ -544,3 +547,6 @@ replace (
// Doc generation tooling.
// (using our fork of github.com/hashicorp/terraform-plugin-docs)
tool github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs

// Protoc plugin generating terraform schema
tool github.com/gravitational/protoc-gen-terraform/v4
Loading
Loading