Skip to content
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

Merged
merged 10 commits into from
May 17, 2024

Conversation

austinvalle
Copy link
Member

This PR introduces a new plan and apply flag -allow-deferral. This flag enables the deferred actions experiment that was introduced in Terraform v1.9.0-alpha20240404

Notes

  • I wasn't sure if there was an external interface for checking that experiments are enabled from the Terraform CLI, so I just check for alpha or dev in the version as a best effort. Happy to update with a more accurate method if one exists!

@austinvalle austinvalle added the enhancement New feature or request label May 1, 2024
@austinvalle austinvalle added this to the v0.21.0 milestone May 1, 2024
Comment on lines +43 to +46
if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" {
t.Skip("Terraform for darwin/arm64 is not available until v1")
}

Copy link
Member Author

Choose a reason for hiding this comment

The 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 setup-terraform last week: hashicorp/setup-terraform#409

I'm not sure if we want to default fallback to amd64 or if skipping this on arm64 is acceptable.

Copy link
Member

Choose a reason for hiding this comment

The 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.

@@ -80,7 +80,7 @@ jobs:
- resolve-versions
- static-checks
runs-on: ${{ matrix.os }}
timeout-minutes: 10
timeout-minutes: 20
Copy link
Member Author

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 Go 1.22.x on windows-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

Copy link
Member

@liamcervante liamcervante left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me, I will chase Katy or Radek for a quick look in case I'm missing something as I haven't look closely at this before.

@@ -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 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would've probably called this versionIsPrerelease() or something along these lines, as that's what the function actually does but it's also not exposed API to downstream so I'm not too worried about the name here.

Comment on lines +43 to +46
if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" {
t.Skip("Terraform for darwin/arm64 is not available until v1")
}

Copy link
Member

Choose a reason for hiding this comment

The 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.

@radeksimko radeksimko merged commit a9c9728 into main May 17, 2024
72 checks passed
@radeksimko radeksimko deleted the av/allow-deferral branch May 17, 2024 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants