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

README.md, src/main.sh, test/local-test.sh: Support for 'run-all' options #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

maniankara
Copy link

  1. Support for run-all command line options
  2. test/local-test.sh: Added script to run local testing
  3. README.md: Updated about local testing

…ions

1. test/local-test.sh: Added script to run local testing
2. README.md: Updated about local testing
…li to docker container

1. Adding equivalent support for args param in github actions step
@spol-vt
Copy link

spol-vt commented Mar 11, 2021

Is this project still maintained? Being able to use 'run-all' Terragrunt sub-commands is a must, without it this GH action is very limited and not reflecting real live use cases.

@spol-vt
Copy link

spol-vt commented Mar 11, 2021

@maniankara btw. did you cater for --terragrunt-non-interactive? otherwise TG will prompt for (y/n) input on run-all sub commands.

@maniankara
Copy link
Author

@spol-vt I think I didnt test it, but I think it should be just passed to terragrunt and handled.

@Frituurpanda
Copy link

Can we merge this please?

@wyarde
Copy link

wyarde commented Nov 12, 2021

I think it might already work by ab(using) the tf_actions_binary property:

with:
  tf_actions_binary: "terragrunt run-all"

@mjmayer
Copy link

mjmayer commented Feb 11, 2022

I think it might already work by ab(using) the tf_actions_binary property:

with:
  tf_actions_binary: "terragrunt run-all"

Setting tf_actions_binary: "terragrunt run-all" gets us half way there. The run-all flag will cause terragrunt to interactively prompt for confirmation before executing. Setting the environment variable TF_INPUT=false will suppress this prompt. Terragrunt cli options

@ulankford
Copy link

Does this PR actually work? I don't think it does.

I have the following set.

      - name: 'Terragrunt run-all apply'
        uses: maniankara/terragrunt-github-actions@master
        with:
          tf_actions_version: ${{ env.tf_version }}
          tg_actions_version: ${{ env.tg_version }}
          tf_actions_binary: 'terragrunt'
          tf_actions_subcommand: 'run-all apply'
          tf_actions_working_dir: 'ap-southeast-2/dev'
        env:
          AWS_DEFAULT_REGION: 'ap-southeast-2'
          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID}}
          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY}}
          TF_INPUT: false

Which outputs the following.

Moving Terragrunt v0.36.6 to PATH
Successfully moved Terragrunt v0.36.6
apply: info: applying Terragrunt configuration in ap-southeast-2/dev
apply: error: failed to apply Terragrunt configuration in ap-southeast-2/dev
time=2022-04-10T20:23:20Z level=error msg=Error reading file at path /github/workspace/ap-southeast-2/dev/terragrunt.hcl: open /github/workspace/ap-southeast-2/dev/terragrunt.hcl: no such file or directory
time=2022-04-10T20:23:20Z level=error msg=Unable to determine underlying exit code, so Terragrunt will exit with error code 1

Basically, the code is a hack to pretend the apply subcommand will work if we put in a run-all prefix but 'terragrunt run-all apply' is actually different from just doing a 'terragrunt apply'. The latter needs a terragrunt.hcl file in the working directory, while the run-all apply doesn't need a terragrunt.hcl file.
In this instance, it is looking for it, unless I am missing something in my configuration?

@mjmayer
Copy link

mjmayer commented Apr 11, 2022

@ulankford I'm not sure if the PR works. I used @wyarde suggestion with the main branch, setting tf_actions_binary: "terragrunt run-all" will cause terragrunt to execute the comand terragrunt run-all apply

Working code from my environment

      - name: Terragrunt Apply
        if: github.ref == 'refs/heads/main'
        uses: the-commons-project/terragrunt-github-actions@master
        with:
          tf_actions_version: ${{ env.tf_version }}
          tg_actions_version: ${{ env.tg_version }}
          tf_actions_cli_credentials_token: ${{ secrets.TF_API_TOKEN_DEV }}
          tf_actions_binary: "terragrunt run-all"
          tf_actions_subcommand: 'apply'
          tf_actions_working_dir: ${{ env.tf_working_dir }}
          tf_actions_comment: true
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          KUBERGRUNT_EXEC: ${{ github.workspace }}/tmp_bin/kubergrunt

@ulankford
Copy link

Yes, that does work for me too now. Thanks for posting that.

@ChaosGears-AdamDomagala
Copy link

ChaosGears-AdamDomagala commented Feb 15, 2023

For anyone still having problems,

        env:
          TF_INPUT: false

Does not work but,

        env:
          TF_INPUT: `false`

↑ works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants