Class: Dependabot::Terraform::FileFetcher

Inherits:
FileFetchers::Base
  • Object
show all
Extended by:
T::Helpers, T::Sig
Includes:
FileFilter
Defined in:
lib/dependabot/terraform/file_fetcher.rb

Constant Summary collapse

LOCAL_PATH_SOURCE =
%r{source\s*=\s*['"](?<path>..?\/[^'"]+)}

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.required_files_in?(filenames) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/dependabot/terraform/file_fetcher.rb', line 22

def self.required_files_in?(filenames)
  filenames.any? { |f| f.end_with?(".tf", ".hcl") }
end

.required_files_messageObject



27
28
29
# File 'lib/dependabot/terraform/file_fetcher.rb', line 27

def self.required_files_message
  "Repo must contain a Terraform configuration file."
end

Instance Method Details

#fetch_filesObject



32
33
34
35
36
37
38
39
# File 'lib/dependabot/terraform/file_fetcher.rb', line 32

def fetch_files
  fetched_files = []
  fetched_files += terraform_files
  fetched_files += terragrunt_files
  fetched_files += local_path_module_files(terraform_files)
  fetched_files += [lockfile] if lockfile
  fetched_files
end