Skip to content

Use go tool to run protoc-gen-terraform - #69437

Merged
hugoShaka merged 1 commit into
masterfrom
hugo/tf-protoc-go-tool
Aug 7, 2026
Merged

Use go tool to run protoc-gen-terraform#69437
hugoShaka merged 1 commit into
masterfrom
hugo/tf-protoc-go-tool

Conversation

@hugoShaka

Copy link
Copy Markdown
Contributor

This PR uses go tool to install and manage the protoc-gen-terraform plugin responsible for generating the Terraform schemas.

This provides the following benefits:

  • devs don't need to manually install tools
  • switching between different branches and versions is now transparent
  • we track the version in a single place
  • in case of repo compromise, it is impossible to install a wrong version, the go.sum will reject the install

@hugoShaka
hugoShaka requested a review from bernardjkim August 6, 2026 20:23
@hugoShaka hugoShaka added the no-changelog Indicates that a PR does not require a changelog entry label Aug 6, 2026
@hugoShaka
hugoShaka requested a review from aadc-dev as a code owner August 6, 2026 20:23
@hugoShaka hugoShaka added backport/branch/v17 backport/branch/v18 no-test-plan Bypasses the test plan validation bot labels Aug 6, 2026

@zmb3 zmb3 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine, though you might consider following the dedicated-go.mod pattern that we have under build.assets/tools.

@hugoShaka

hugoShaka commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Seems fine, though you might consider following the dedicated-go.mod pattern that we have under build.assets/tools.

I'm not super comfortable with the makefile crimes we're committing to do this:

teleport/common.mk

Lines 57 to 67 in 8ea6a9b

COMMON_MK_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
# This allows $(GOTESTSUM) in any Makefile that includes common.mk:
# TOOLS_DIR contains external test tools
TOOLS_DIR := $(abspath $(COMMON_MK_DIR)/build.assets/tools)
GOTESTSUM = "$$( GOWORK=off go -C $(TOOLS_DIR)/gotestsum tool -n gotestsum )"
GCI = "$$( GOWORK=off go -C $(TOOLS_DIR)/gci tool -n gci )"
GODA = "$$( GOWORK=off go -C $(TOOLS_DIR)/goda tool -n goda )"
BENCHSTAT = "$$( GOWORK=off go -C $(TOOLS_DIR)/benchstat tool -n benchstat )"
# TOOLING_DIR contains internal tooling
TOOLING_DIR := $(abspath $(COMMON_MK_DIR)/build.assets/tooling)
HELMJANITOR = "$$( GOWORK=off CGO_ENABLED=0 go -C $(TOOLING_DIR) tool -n helm-janitor )"

I also spent 5 hours debugging this because the hacks we did doesn't work with exported variables and make -e.
We do call make -e in some CI targets, and export every variable in the Makefile for some reason.

@hugoShaka
hugoShaka force-pushed the hugo/tf-protoc-go-tool branch from fcf27f1 to 6460dc5 Compare August 7, 2026 17:25
@hugoShaka
hugoShaka added this pull request to the merge queue Aug 7, 2026
Merged via the queue into master with commit afd9179 Aug 7, 2026
46 checks passed
@hugoShaka
hugoShaka deleted the hugo/tf-protoc-go-tool branch August 7, 2026 19:22
@backport-bot-workflows

Copy link
Copy Markdown
Contributor

@hugoShaka See the table below for backport results.

Branch Result
branch/v17 Failed
branch/v18 Failed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/branch/v17 backport/branch/v18 no-changelog Indicates that a PR does not require a changelog entry no-test-plan Bypasses the test plan validation bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants