Class: Dependabot::Opentofu::FileParser

Inherits:
FileParsers::Base
  • Object
show all
Extended by:
T::Sig
Includes:
FileSelector
Defined in:
lib/dependabot/opentofu/file_parser.rb

Constant Summary collapse

DEFAULT_REGISTRY =
"registry.opentofu.org"
DEFAULT_NAMESPACE =
"hashicorp"
PROVIDER_SOURCE_ADDRESS =
%r{\A((?<hostname>.+)/)?(?<namespace>.+)/(?<name>.+)\z}
BUILTIN_PROVIDER_NAMESPACES =

Namespaces reserved for providers bundled with the OpenTofu/Terraform binary. Providers in these namespaces cannot be updated independently because their version tracks the binary itself. See: pkg.go.dev/github.com/opentofu/registry-address/v2#Provider.IsBuiltIn

T.let(
  %w(
    terraform.io/builtin
    opentofu.org/builtin
  ).freeze,
  T::Array[String]
)

Constants included from FileSelector

Dependabot::Opentofu::FileSelector::OVERRIDE_TF_EXTENSION, Dependabot::Opentofu::FileSelector::OVERRIDE_TOFU_EXTENSION, Dependabot::Opentofu::FileSelector::TF_EXTENSION, Dependabot::Opentofu::FileSelector::TOFU_EXTENSION

Instance Method Summary collapse

Methods included from FileSelector

#dependency_files

Instance Method Details

#ecosystemObject



57
58
59
60
61
62
63
64
65
66
67
# File 'lib/dependabot/opentofu/file_parser.rb', line 57

def ecosystem
  @ecosystem ||= T.let(
    begin
      Ecosystem.new(
        name: ECOSYSTEM,
        package_manager: package_manager
      )
    end,
    T.nilable(Dependabot::Ecosystem)
  )
end

#parseObject



46
47
48
49
50
51
52
53
54
# File 'lib/dependabot/opentofu/file_parser.rb', line 46

def parse
  dependency_set = DependencySet.new

  parse_opentofu_files(dependency_set)

  parse_terragrunt_files(dependency_set)

  dependency_set.dependencies.sort_by(&:name)
end