-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Implemented the basic functionality of tfbox.
- Loading branch information
1 parent
f7212d1
commit ba8c529
Showing
12 changed files
with
899 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.idea |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
"github.com/spf13/cobra" | ||
"github.com/vahid-haghighat/tfbox/internal" | ||
"os" | ||
) | ||
|
||
var workingDirectory string | ||
var tfVersion string | ||
var rootDirectory string | ||
|
||
var rootCmd = &cobra.Command{ | ||
Use: "tfbox", | ||
Short: "Runs terraform inside docker", | ||
Long: `"Runs terraform inside docker"`, | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
tfArgs := cmd.Flags().Args() | ||
|
||
if len(tfArgs) == 0 { | ||
return fmt.Errorf("you need to pass terraform commands/flags") | ||
} | ||
return internal.Run(rootDirectory, workingDirectory, tfVersion, tfArgs) | ||
}, | ||
Args: func(cmd *cobra.Command, args []string) error { | ||
return nil | ||
}, | ||
} | ||
|
||
func Execute() { | ||
err := rootCmd.Execute() | ||
if err != nil { | ||
os.Exit(1) | ||
} | ||
} | ||
|
||
func init() { | ||
rootCmd.Flags().StringVarP(&rootDirectory, "root", "r", "", "The root of the project") | ||
rootCmd.Flags().StringVarP(&workingDirectory, "directory", "d", ".", "Terraform working directory relative to root directory") | ||
rootCmd.Flags().StringVarP(&tfVersion, "version", "v", "", "Terraform version to use") | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
"github.com/vahid-haghighat/tfbox/version" | ||
|
||
"github.com/spf13/cobra" | ||
) | ||
|
||
// versionCmd represents the version command | ||
var versionCmd = &cobra.Command{ | ||
Use: "version", | ||
Short: "tfbox version", | ||
Long: `tfbox version`, | ||
Run: func(cmd *cobra.Command, args []string) { | ||
fmt.Println(version.Version) | ||
}, | ||
} | ||
|
||
func init() { | ||
rootCmd.AddCommand(versionCmd) | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
module github.com/vahid-haghighat/tfbox | ||
|
||
go 1.23.4 | ||
|
||
require ( | ||
github.com/PuerkitoBio/goquery v1.10.1 | ||
github.com/docker/docker v27.4.1+incompatible | ||
github.com/hashicorp/go-version v1.7.0 | ||
github.com/hashicorp/hc-install v0.9.1 | ||
github.com/hashicorp/terraform-config-inspect v0.0.0-20241129133400-c404f8227ea6 | ||
github.com/spf13/cobra v1.8.1 | ||
) | ||
|
||
require ( | ||
github.com/Microsoft/go-winio v0.6.1 // indirect | ||
github.com/agext/levenshtein v1.2.2 // indirect | ||
github.com/andybalholm/cascadia v1.3.3 // indirect | ||
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect | ||
github.com/containerd/log v0.1.0 // indirect | ||
github.com/distribution/reference v0.6.0 // indirect | ||
github.com/docker/go-connections v0.5.0 // indirect | ||
github.com/docker/go-units v0.5.0 // indirect | ||
github.com/felixge/httpsnoop v1.0.4 // indirect | ||
github.com/go-logr/logr v1.4.2 // indirect | ||
github.com/go-logr/stdr v1.2.2 // indirect | ||
github.com/gogo/protobuf v1.3.2 // indirect | ||
github.com/google/go-cmp v0.6.0 // indirect | ||
github.com/hashicorp/hcl v0.0.0-20170504190234-a4b07c25de5f // indirect | ||
github.com/hashicorp/hcl/v2 v2.20.1 // indirect | ||
github.com/inconshreveable/mousetrap v1.1.0 // indirect | ||
github.com/mitchellh/go-wordwrap v1.0.0 // indirect | ||
github.com/moby/docker-image-spec v1.3.1 // indirect | ||
github.com/moby/term v0.5.2 // indirect | ||
github.com/morikuni/aec v1.0.0 // indirect | ||
github.com/opencontainers/go-digest v1.0.0 // indirect | ||
github.com/opencontainers/image-spec v1.1.0 // indirect | ||
github.com/pkg/errors v0.9.1 // indirect | ||
github.com/spf13/pflag v1.0.5 // indirect | ||
github.com/zclconf/go-cty v1.14.4 // indirect | ||
go.opentelemetry.io/auto/sdk v1.1.0 // indirect | ||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.58.0 // indirect | ||
go.opentelemetry.io/otel v1.33.0 // indirect | ||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.33.0 // indirect | ||
go.opentelemetry.io/otel/metric v1.33.0 // indirect | ||
go.opentelemetry.io/otel/sdk v1.33.0 // indirect | ||
go.opentelemetry.io/otel/trace v1.33.0 // indirect | ||
golang.org/x/mod v0.22.0 // indirect | ||
golang.org/x/net v0.33.0 // indirect | ||
golang.org/x/sync v0.10.0 // indirect | ||
golang.org/x/sys v0.29.0 // indirect | ||
golang.org/x/text v0.21.0 // indirect | ||
golang.org/x/time v0.9.0 // indirect | ||
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect | ||
gotest.tools/v3 v3.5.1 // indirect | ||
) |
Oops, something went wrong.