Class: Dependabot::Terraform::UpdateChecker

Inherits:
UpdateCheckers::Base
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dependabot/terraform/update_checker.rb

Constant Summary collapse

ELIGIBLE_SOURCE_TYPES =
T.let(
  %w(git provider registry).freeze,
  T::Array[String]
)

Instance Method Summary collapse

Instance Method Details

#latest_resolvable_versionObject



34
35
36
37
38
# File 'lib/dependabot/terraform/update_checker.rb', line 34

def latest_resolvable_version
  # No concept of resolvability for terraform modules (that we're aware
  # of - there may be in future).
  latest_version
end

#latest_resolvable_version_with_no_unlockObject



41
42
43
44
# File 'lib/dependabot/terraform/update_checker.rb', line 41

def latest_resolvable_version_with_no_unlock
  # Irrelevant, since Terraform doesn't have a lockfile
  nil
end

#latest_versionObject



25
26
27
28
29
30
31
# File 'lib/dependabot/terraform/update_checker.rb', line 25

def latest_version
  return latest_version_for_git_dependency if git_dependency?
  return latest_version_for_registry_dependency if registry_dependency?

  latest_version_for_provider_dependency if provider_dependency?
  # Other sources (mercurial, path dependencies) just return `nil`
end

#requirements_unlocked_or_can_be?Boolean

Returns:

  • (Boolean)


56
57
58
59
60
# File 'lib/dependabot/terraform/update_checker.rb', line 56

def requirements_unlocked_or_can_be?
  # If the requirement comes from a proxy URL then there's no way for
  # us to update it
  !proxy_requirement?
end

#updated_requirementsObject



47
48
49
50
51
52
53
# File 'lib/dependabot/terraform/update_checker.rb', line 47

def updated_requirements
  RequirementsUpdater.new(
    requirements: dependency.requirements,
    latest_version: latest_version&.to_s,
    tag_for_latest_version: tag_for_latest_version
  ).updated_requirements
end