Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supporting generation of projects for terragrunt workspaces #424

Open
motatoes opened this issue Jul 5, 2023 · 5 comments
Open

Supporting generation of projects for terragrunt workspaces #424

motatoes opened this issue Jul 5, 2023 · 5 comments
Labels
enhancement New feature or request user-reported

Comments

@motatoes
Copy link
Contributor

motatoes commented Jul 5, 2023

We currently support generating projects dynamically for terraform projects using the toplevel generate_projects pattern https://docs.digger.dev/configuration/digger.yml#top-level

We would like to support the same for terragrunt projects This can be done similar to [1] but traversing for terragrunt.hcl files and analysing dependencies for building the dependency graph

[1] https://github.com/transcend-io/terragrunt-atlantis-config

@nilsdebruin
Copy link

Great!

@motatoes
Copy link
Contributor Author

motatoes commented Sep 1, 2023

Hi @nilsdebruin this is now supported and here are the docs page for it: https://docs.digger.dev/configuration/terragrunt-project-generation

Please give it a shot and let us know if that addresses it for you!

@Nilsas
Copy link

Nilsas commented Oct 21, 2023

Hey Guys, just found this issue, I'm trying to setup terragrunt, but generate projects does not seem to be working, my digger.yml

generate_projects:
  terragrunt_parsing:
    parallel: true
    createProjectName: true
    createWorkspace: true
    defaultWorkflow: default

workflows:
  default:
    plan:
      steps:
        - init
        - plan
    apply:
      steps:
      - init
      - apply:
        extra_args: ["-compact-warnings"]
    workflow_configuration:
      on_pull_request_pushed: ["digger plan"]
      on_pull_request_closed: ["digger unlock"]
      on_commit_to_default: ["digger apply"]

github actions pipeline

name: CI

on:
  pull_request:
    branches: 
      - "master"
    types: 
      - closed 
      - opened
      - synchronize
      - reopened
  issue_comment:
    types: 
      - created
    if: contains(github.event.comment.body, 'digger')
  workflow_dispatch:

jobs:
  build:
    runs-on: self-hosted
    permissions:
      id-token: write
      contents: read
      issues: write
      pull-requests: write

    steps:
      - uses: actions/checkout@v3

      - name: Checkout Pull Request
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          PR_URL="${{ github.event.issue.pull_request.url }}"
          PR_NUM=${PR_URL##*/}
          echo "Checking out from PR #$PR_NUM based on URL: $PR_URL"
          hub pr checkout $PR_NUM
        if: github.event_name == 'issue_comment'

      - name: digger run
        uses: diggerhq/[email protected]
        with:
          setup-google-cloud: true # FOR aws use setup-aws instead
          google-auth-credentials: '${{ secrets.GCP_CREDENTIALS }}'
          setup-terragrunt: true
          terragrunt-version: 0.45.0
        env:
          LOCK_PROVIDER: gcp
          GITHUB_CONTEXT: ${{ toJson(github) }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          GOOGLE_STORAGE_BUCKET: digger_bucket

I am seeing this in the logs

 2023/10/21 05:34:18 Using GCP lock provider.
Lock provider has been created successfully
Using GitHub.
GitHub context parsed successfully
Digger config read successfully
2023/10/21 05:34:18 Using GCP lock provider.
Lock provider has been created successfully
2023/10/21 05:34:19 Following projects are impacted by pull request #2
No projects impacted
GitHub event processed successfully

Obviously my PR has relevant changes to the terragrunt.hcl files. I have setup Atlantis and terragrunt-atlantis-config on the same repository it manages to plan the changes.
What am I doing wrong here? @motatoes

@motatoes
Copy link
Contributor Author

hey @Nilsas I'm not spotting anything there, likely some bug, it would be helpful if you can share with me a repo to help me debug the issue !

@zMynxx
Copy link

zMynxx commented Mar 28, 2024

have you figured how to run digger destroy <project> when using the auto-generator?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request user-reported
Projects
None yet
Development

No branches or pull requests

4 participants