Skip to content

Commit

Permalink
graph: update format for v1.7 (#424)
Browse files Browse the repository at this point in the history
  • Loading branch information
kmoe authored Nov 29, 2023
1 parent ccb7b50 commit a2bb72f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tfexec/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (tf *Terraform) graphCmd(ctx context.Context, opts ...GraphOption) (*exec.C
args := []string{"graph"}

if c.plan != "" {
// plan was a positional arguement prior to Terraform 0.15.0. Ensure proper use by checking version.
// plan was a positional argument prior to Terraform 0.15.0. Ensure proper use by checking version.
if err := tf.compatible(ctx, tf0_15_0, nil); err == nil {
args = append(args, "-plan="+c.plan)
} else {
Expand Down
14 changes: 12 additions & 2 deletions tfexec/internal/e2etest/graph_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ func expectedGraphOutput(tfv *version.Version) string {
`
}

// 1.1.0+
return `digraph {
if v.GreaterThanOrEqual(v1_1) && v.LessThan(v1_7) {
// 1.1.0 - 1.7.0
return `digraph {
compound = "true"
newrank = "true"
subgraph "root" {
Expand All @@ -109,5 +110,14 @@ func expectedGraphOutput(tfv *version.Version) string {
}
}
`
}

// 1.7.0+
return `digraph G {
rankdir = "RL";
node [shape = rect, fontname = "sans-serif"];
"null_resource.foo" [label="null_resource.foo"];
}
`
}
1 change: 1 addition & 0 deletions tfexec/internal/e2etest/providers_schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ var (
v0_15_0 = version.Must(version.NewVersion("0.15.0"))
v1_0 = version.Must(version.NewVersion("1.0.0"))
v1_1 = version.Must(version.NewVersion("1.1.0"))
v1_7 = version.Must(version.NewVersion("1.7.0"))
)

func TestProvidersSchema(t *testing.T) {
Expand Down

0 comments on commit a2bb72f

Please sign in to comment.