[TFgen] Adding a new terraform generator#3840
Draft
Supam wants to merge 9 commits into
Draft
Conversation
Member
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
This comment has been minimized.
This comment has been minimized.
This was referenced Jun 2, 2026
This was referenced Jun 2, 2026
2 tasks
3cd9cf1 to
9dd3b48
Compare
This was referenced Jun 3, 2026
Setup commit for the new generator CLI.
Added stubs for the current .go files. Added cobra, libopenapi, and their dependencies to the LICENSE-3rdparty file.
* [1.4] Add a github workflow for build + vet * [1.5] Add make command to build/test the generator * [1.6] Create testdata/fixtures with README * root formatting fixes * updated 1.4 to any branch and added go depencency files to paths
Added enums : - ArtifactKind - SchemaKind - IdStrategy Added structs: - Spec - Operation - Schema - Artifact - TrackingFieldMetadata - various other supporting structs...
* [TFgen] Added a identifier translator to match the goSDK The translator will transform the OAS snake_case names into the equivalent PascalCase that are used in the go SDK. Removed internal ticket names. * [TFgen] Added .gitignore
* [TFgen] Added a parser to load the OAS Added the parser's test data do `testdata/parser` * [TFgen] Added $ref cycle detection * [TFgen] Fail fast on circular $refs and wire --max-depth LoadSpec now resolves the component schema graph before enumerating: a circular $ref returns a typed *RefCycleError naming the offending ref, and expansion past --max-depth returns a depth error. The --max-depth flag is now wired through the generate command. * [TFgen] Added -race and -cover to the `make tfgen-test` command * [TFgen] (Nit) Addressed some minor concerns - Added better fixture coverage for allOf / anyOf - Added custom error for when max depth is reached in cycles.go
…tection (#3853) * Implement tracking-field decoder + duplicate artifact name detection * Fixed potential errors with missing skip values. * Support for ignoring duplicates if they have different kinds. * comment/contracts cleanup * removed redundant testing while keeping the same coverage
* [TFgen] Added a report structure Added a report structure for after run reports. This will be used by CI and may be used by other tools downstream. * [TFgen] Added tests for the reporting structure * [TFgen] Started wiring the reporter Set initial values for the run report in the generate command. The rest of the content should be filled by the actual generation. * [TFgen] Fix empty generator_version and gofmt the report layer cmd.Version is empty on the generate subcommand: cobra does not propagate Version from the root command, so the report's generator_version field was always "". Read it from cmd.Root().Version, where main.go stamps it. Also gofmt the RunReport and Spec struct literals (value alignment, stray blank lines) and fix a doc-comment typo in report.go.
* [TFgen] Added a report structure Added a report structure for after run reports. This will be used by CI and may be used by other tools downstream. * [TFgen] Added tests for the reporting structure * [TFgen] Started wiring the reporter Set initial values for the run report in the generate command. The rest of the content should be filled by the actual generation. * [TFgen] Fix empty generator_version and gofmt the report layer cmd.Version is empty on the generate subcommand: cobra does not propagate Version from the root command, so the report's generator_version field was always "". Read it from cmd.Root().Version, where main.go stamps it. Also gofmt the RunReport and Spec struct literals (value alignment, stray blank lines) and fix a doc-comment typo in report.go. * [TFgen] (CI) Added the generator go.mod to the license check Added .generator-v2/go.sum to GO-SUMS when the file exists. This will prevent the generator-v2 dependencies flying under the radar * [TFgen] (CI) Added 3rd party licenses used in tfgen The License check was previously not run in the generator. Now that is is I have updated the file to add the used licences.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Introduces
.generator-v2/, a new standalone Go module that will replace the hand-written Terraform resource/data source authoring workflow. The generator reads the Datadog OpenAPI Specification, respects ax-datadog-tf-generatortracking field, and emits Go source code using the Datadog go-sdk.This PR adds the module skeleton only:
cmd/tfgen/main.goentry point with Cobra root command--spec,--output-root,--hooks-root,--tracking-field,--max-depth,--report,--quiet)tfgen generateandtfgen verifysubcommands (no-op stubs)parser,model,emit,hooks,report)cd .generator-v2 && go test ./...Test Plan