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

Running InitAndPlanE will always update modules #877

Closed
alan2wong opened this issue Apr 23, 2021 · 1 comment · Fixed by #880
Closed

Running InitAndPlanE will always update modules #877

alan2wong opened this issue Apr 23, 2021 · 1 comment · Fixed by #880
Labels
bug Something isn't working

Comments

@alan2wong
Copy link

alan2wong commented Apr 23, 2021

The Terraform Options struct includes the option to disable upgrading during terraform init, but even if this is set to false, an upgrade still occurs due to terraform get -upgrade always being called during InitAndPlanE:

  • InitAndPlanE calls both InitE and GetE:
    func InitAndPlanE(t testing.TestingT, options *Options) (string, error) {
    if _, err := InitE(t, options); err != nil {
    return "", err
    }
    if _, err := GetE(t, options); err != nil {
    return "", err
    }
    return PlanE(t, options)
    }
  • GetE is set to always call terraform get -update which forces an update:
    func GetE(t testing.TestingT, options *Options) (string, error) {
    return RunTerraformCommandE(t, options, "get", "-update")
    }

The expected behavior is if Upgrade is set to false or not set, no upgrade should be run by either init or get.

@yorinasub17
Copy link
Contributor

This is now fixed in https://github.com/gruntwork-io/terratest/releases/tag/v0.34.1, where the call to get is removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants