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}
LOCAL_REFERENCE_REGEX =
/\A\$\{local\.(?<var_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: https://pkg.go.dev/github.com/opentofu/registry-address/v2#Provider.IsBuiltIn

%w(
  terraform.io/builtin
  opentofu.org/builtin
).freeze

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



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

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

#parseObject



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

def parse
  dependency_set = DependencySet.new

  parse_opentofu_files(dependency_set)

  parse_terragrunt_files(dependency_set)

  dependency_set.dependencies.sort_by(&:name)
end