Skip to content

Commit

Permalink
update terragen to use structure that has directory per resource/data…
Browse files Browse the repository at this point in the history
… source

This change is to "solve" the long compilation times. By splitting generated
code into a pkg per type, it avoids one massive pkg with all the resources.
  • Loading branch information
jlarfors committed Apr 15, 2024
1 parent 55f7073 commit 8229f9b
Show file tree
Hide file tree
Showing 114 changed files with 4,554 additions and 11,800 deletions.
24 changes: 16 additions & 8 deletions cmd/terragen/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ Usage:
The flags are:
-force
override any existing generated Go files (required)
force code generation even if out is not an empty directory
-clean
clean the out directory before generating Go files
-out string
directory to generate Go files in (required)
-pkg string
Go pkg for the generated Go files (required)
-provider value
provider to generate Go files for (required), e.g. aws=hashicorp/aws:4.49.0
provider to generate Go files for (required),
e.g. aws=hashicorp/aws:4.49.0
-tfout string
directory to generate Terraform providers schema (default ".lingon/schemas")
directory to generate Terraform providers schema
(default ".lingon/schemas")
*/
package main

Expand All @@ -49,6 +49,7 @@ func main() {
pkgPath string
providerStr string
force bool
clean bool
v bool
)

Expand All @@ -70,7 +71,13 @@ func main() {
&force,
"force",
false,
"override any existing generated Go files",
"force code generation even if out is not an empty directory",
)
flag.BoolVar(
&clean,
"clean",
false,
"clean the out directory before generating Go files",
)
flag.BoolVar(&v, "v", false, "show version")

Expand Down Expand Up @@ -125,6 +132,7 @@ func main() {
OutDir: outDir,
PkgPath: pkgPath,
Force: force,
Clean: clean,
},
schemas,
); err != nil {
Expand Down
2 changes: 2 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/.lingon/
**/out/
37 changes: 3 additions & 34 deletions docs/go.mod
Original file line number Diff line number Diff line change
@@ -1,27 +1,16 @@
module github.com/golingon/lingon/docs

go 1.21
go 1.21.7

replace github.com/golingon/lingon => ../

require (
github.com/Masterminds/semver/v3 v3.2.1
github.com/aws/karpenter v0.29.2
github.com/aws/karpenter-core v0.29.2
github.com/eidolon/wordwrap v0.0.0-20161011182207-e0f54129b8bb
github.com/fatih/color v1.15.0
github.com/go-playground/validator/v10 v10.19.0
github.com/golingon/lingon v0.0.0-20230821085204-81fbacc93e96
github.com/golingon/terraproviders/aws/4.60.0 v0.0.0-20230821062044-8717820dd713
github.com/golingon/terraproviders/tls/4.0.4 v0.0.0-20230821062044-8717820dd713
github.com/google/go-containerregistry v0.16.1
github.com/golingon/lingon v0.0.0-20240410151041-d6e1fef1f2a8
github.com/hashicorp/hcl/v2 v2.20.1
github.com/hashicorp/terraform-exec v0.20.0
github.com/hashicorp/terraform-json v0.19.0
github.com/hexops/valast v1.4.4
github.com/invopop/yaml v0.2.0
github.com/rogpeppe/go-internal v1.12.0
github.com/stretchr/testify v1.8.4
github.com/zegl/kube-score v1.17.0
istio.io/api v1.19.0-beta.1
istio.io/client-go v1.18.1
Expand All @@ -35,53 +24,34 @@ require (
require (
github.com/agext/levenshtein v1.2.3 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
github.com/aws/aws-sdk-go v1.44.329 // indirect
github.com/containerd/stargz-snapshotter/estargz v0.14.3 // indirect
github.com/dave/jennifer v1.7.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/docker/cli v24.0.5+incompatible // indirect
github.com/docker/distribution v2.8.2+incompatible // indirect
github.com/docker/docker v24.0.5+incompatible // indirect
github.com/docker/docker-credential-helpers v0.8.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.19.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.16.7 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0-rc4 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/samber/lo v1.38.1 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/tidwall/gjson v1.17.1 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
github.com/tidwall/sjson v1.2.5 // indirect
github.com/vbatts/tar-split v0.11.5 // indirect
github.com/veggiemonk/strcase v0.0.0-20230627213939-a882c834bcab // indirect
github.com/volvo-cars/lingon v0.0.0-20230814121704-8832578d7bbf // indirect
github.com/zclconf/go-cty v1.14.1 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.19.0 // indirect
golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.17.0 // indirect
Expand All @@ -93,7 +63,6 @@ require (
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/klog/v2 v2.110.1 // indirect
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
knative.dev/pkg v0.0.0-20230821102121-81e4ee140363 // indirect
mvdan.cc/gofumpt v0.6.0 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
Expand Down
Loading

0 comments on commit 8229f9b

Please sign in to comment.