-
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.
- Loading branch information
Showing
5 changed files
with
40 additions
and
6 deletions.
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
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,24 @@ | ||
package cmd_test | ||
|
||
import ( | ||
"github.com/tiulpin/tftl/cmd" | ||
"os" | ||
"path/filepath" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestParseTerraformFile(t *testing.T) { | ||
content := `resource "aws_instance" "example" {}` | ||
tempDir := t.TempDir() | ||
filePath := filepath.Join(tempDir, "test.tf") | ||
|
||
err := os.WriteFile(filePath, []byte(content), 0644) | ||
require.NoError(t, err) | ||
|
||
targets, parseErr := cmd.ParseTerraformFile(filePath) | ||
require.NoError(t, parseErr) | ||
require.Equal(t, 1, len(targets)) | ||
require.Equal(t, "aws_instance.example", targets[0]) | ||
} |
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 |
---|---|---|
@@ -1,21 +1,25 @@ | ||
module tftl | ||
module github.com/tiulpin/tftl | ||
|
||
go 1.24.0 | ||
|
||
require ( | ||
github.com/hashicorp/hcl/v2 v2.23.0 | ||
github.com/spf13/cobra v1.9.1 | ||
github.com/stretchr/testify v1.10.0 | ||
) | ||
|
||
require ( | ||
github.com/agext/levenshtein v1.2.1 // indirect | ||
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect | ||
github.com/davecgh/go-spew v1.1.1 // indirect | ||
github.com/inconshreveable/mousetrap v1.1.0 // indirect | ||
github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 // indirect | ||
github.com/pmezard/go-difflib v1.0.0 // indirect | ||
github.com/spf13/pflag v1.0.6 // indirect | ||
github.com/zclconf/go-cty v1.16.2 // indirect | ||
golang.org/x/mod v0.8.0 // indirect | ||
golang.org/x/sys v0.5.0 // indirect | ||
golang.org/x/text v0.11.0 // indirect | ||
golang.org/x/tools v0.6.0 // indirect | ||
gopkg.in/yaml.v3 v3.0.1 // indirect | ||
) |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
package main | ||
|
||
import "tftl/cmd" | ||
import "github.com/tiulpin/tftl/cmd" | ||
|
||
func main() { | ||
cmd.Execute() | ||
|