-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tfexec: Add -allow-deferral
experimental options to Plan
and Apply
commands
#447
Changes from all commits
399b96b
76dbbc5
e0fa5cb
52cd37b
f6fcad1
a93f388
ce1bfe7
7a33242
a1abb29
3dbe350
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ package tfexec | |
|
||
import ( | ||
"context" | ||
"runtime" | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform-exec/tfexec/internal/testutil" | ||
|
@@ -39,6 +40,10 @@ func TestForceUnlockCmd(t *testing.T) { | |
// The optional final positional [DIR] argument is available | ||
// until v0.15.0. | ||
func TestForceUnlockCmd_pre015(t *testing.T) { | ||
if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" { | ||
t.Skip("Terraform for darwin/arm64 is not available until v1") | ||
} | ||
|
||
Comment on lines
+43
to
+46
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Skipping to avoid this error: https://github.com/hashicorp/terraform-exec/actions/runs/8914271134/job/24481540878?pr=447 An unfortunate situation where the latest macos GHA runners now are macOS 14 and ARM64 architecture machines: https://github.blog/changelog/2024-04-01-macos-14-sonoma-is-generally-available-and-the-latest-macos-runner-image/. We ran into this issue on I'm not sure if we want to default fallback to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think skipping on arm64 is acceptable given that the nature of the test is to check for version differences, not so much architecture differences, and the former is already being checked on other platforms as well. |
||
td := t.TempDir() | ||
|
||
tf, err := NewTerraform(td, tfVersion(t, testutil.Latest014)) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,7 @@ var ( | |
tf1_1_0 = version.Must(version.NewVersion("1.1.0")) | ||
tf1_4_0 = version.Must(version.NewVersion("1.4.0")) | ||
tf1_6_0 = version.Must(version.NewVersion("1.6.0")) | ||
tf1_9_0 = version.Must(version.NewVersion("1.9.0")) | ||
) | ||
|
||
// Version returns structured output from the terraform version command including both the Terraform CLI version | ||
|
@@ -180,6 +181,22 @@ func (tf *Terraform) compatible(ctx context.Context, minInclusive *version.Versi | |
return nil | ||
} | ||
|
||
// experimentsEnabled asserts the cached terraform version has experiments enabled in the executable, | ||
// and returns a well known error if not. Experiments are enabled in alpha and (potentially) dev builds of Terraform. | ||
func (tf *Terraform) experimentsEnabled(ctx context.Context) error { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would've probably called this |
||
tfv, _, err := tf.Version(ctx, false) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
preRelease := tfv.Prerelease() | ||
if preRelease == "dev" || strings.Contains(preRelease, "alpha") { | ||
return nil | ||
} | ||
|
||
return fmt.Errorf("experiments are not enabled in version %s, as it's not an alpha or dev build", errorVersionString(tfv)) | ||
} | ||
|
||
func stripPrereleaseAndMeta(v *version.Version) *version.Version { | ||
if v == nil { | ||
return nil | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another GH workflow related change, it seems that
setup-go
is taking an extra 2 minutes to setup Go1.22.x
onwindows-latest
, not leaving enough time for the rest of the job to run 🙂 : https://github.com/hashicorp/terraform-exec/actions/runs/8914407327/job/24482771576?pr=447