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

Bump Terraform from 1.0.11 to 1.1.6 #4748

Merged
merged 4 commits into from
Feb 18, 2022
Merged

Bump Terraform from 1.0.11 to 1.1.6 #4748

merged 4 commits into from
Feb 18, 2022

Conversation

mctofu
Copy link
Contributor

@mctofu mctofu commented Feb 17, 2022

This is a minor release from our last version and includes some new features.

https://github.com/hashicorp/terraform/blob/v1.1/CHANGELOG.md#116-february-16-2022

This update triggered a test failure:

 1) Dependabot::Terraform::FileUpdater#updated_dependency_files when using a lockfile that requires access to an unreachable module raises a helpful error
     Failure/Error:
       expect { subject }.to raise_error(Dependabot::PrivateSourceAuthenticationFailure) do |error|
         expect(error.source).to eq("github.com/dependabot-fixtures/private-terraform-module")
       end

       expected: "github.com/dependabot-fixtures/private-terraform-module"
            got: "git::https://github.com/dependabot-fixtures/private-terraform-module.git"

       (compared using ==)
     # ./spec/dependabot/terraform/file_updater_spec.rb:905:in `block (4 levels) in <top (required)>'
     # /home/dependabot/dependabot-core/common/spec/spec_helper.rb:49:in `block (2 levels) in <top (required)>'
     # ./.bundle/ruby/2.7.0/gems/webmock-3.14.0/lib/webmock/rspec.rb:37:in `block (2 levels) in <top (required)>'

I've addressed this by stripping the git::https:// and .git from git::https://github.com/dependabot-fixtures/private-terraform-module.git to match the previous behavior. It might be possible to see other prefixes like git::ssl:// but the handling of this error is only concerned with https access so I'm allowing other prefixes to pass through unchanged.

This format is expected downstream to suggest remediation options
for github.com repos.
@mctofu mctofu marked this pull request as ready for review February 18, 2022 00:19
@mctofu mctofu requested a review from a team as a code owner February 18, 2022 00:19
@Nishnha
Copy link
Member

Nishnha commented Feb 18, 2022

The test failure might be related to #4440

It's strange to see the error source change though, since we should only ever change the name.

Copy link
Member

@jurre jurre left a comment

Choose a reason for hiding this comment

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

Thanks! I left one nit about extracting a constant but feel free to ignore that as you see fit

@@ -149,7 +149,13 @@ def run_terraform_init
output = e.message

if output.match?(PRIVATE_MODULE_ERROR)
raise PrivateSourceAuthenticationFailure, output.match(PRIVATE_MODULE_ERROR).named_captures.fetch("repo")
repo = output.match(PRIVATE_MODULE_ERROR).named_captures.fetch("repo")
git_https_prefix = %r{^git::https://}
Copy link
Member

Choose a reason for hiding this comment

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

I guess this could be a constant 🤷

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 Went ahead and did this. I was debating this since moving the definition up to the top of the file could hurt readability. That does seem to be a more consistent practice in this repo though so I went with it.

@mctofu mctofu merged commit 01dc8e3 into main Feb 18, 2022
@mctofu mctofu deleted the mctofu/terraform-1.1.6 branch February 18, 2022 20:02
@mctofu mctofu mentioned this pull request Feb 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants