dependabot / dependabot-core

🤖 Dependabot's core logic for creating update PRs.
https://docs.github.com/en/code-security/dependabot
MIT License
4.62k stars 990 forks source link

Support for nested terraform code and directories #9453

Open BhagyaAmarasinghe opened 5 months ago

BhagyaAmarasinghe commented 5 months ago

Is there an existing issue for this?

Feature description

Package Ecosystem

terraform

Description

When adding dependabot for terraform repositories with multiple nested directories:

HorizonNet commented 2 months ago

@BhagyaAmarasinghe How does your Dependabot configuration and directory structure look like? I have a repository, where I also have nested modules in different sub-directories (multiple levels deep), and the following configuration just works fine.

---
version: 2
updates:
  - package-ecosystem: "terraform"
    directory: "/"
    schedule:
      interval: "daily"
      time: "07:00"
      timezone: "Europe/Berlin"

Please note that every module has a versions declaration in it, similar to the following

terraform {
  required_version = "~> 1.9.0"

  required_providers {
    azuread = {
      source  = "hashicorp/azuread"
      version = "2.53.1"
    }
    azurerm = {
      source  = "hashicorp/azurerm"
      version = "3.110.0"
    }
  }
}

On a Dependabot run every single module gets updated within a single PR.

An alternative, if you want to handle directories differently or in groups, you can also use the directories configuration as outlined here.