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

[BUG] Terramate list change bug with Terragrunt in v0.11.4 #1996

Open
parisnakitakejser opened this issue Dec 8, 2024 · 5 comments · May be fixed by #2000
Open

[BUG] Terramate list change bug with Terragrunt in v0.11.4 #1996

parisnakitakejser opened this issue Dec 8, 2024 · 5 comments · May be fixed by #2000
Labels
bug Something isn't working

Comments

@parisnakitakejser
Copy link

Describe the bug
I'm upgrading to Terramate 0.11.4 and now i receive a bug, when i downgrade back to 0.11.3 its working, and the bug out put is

Error: listing changed stacks error: scanning terragrunt modules: parsing Terragrunt file: /Users/pnk/Developer/{repo}/infrastructure/prod/terragrunt.hcl:2,36-52: Invalid function argument; Invalid value for "path" parameter: no file exists at /Users/pnk/Developer/{repo}/infrastructure/prod/eu-west-1/iam-policys/sts-allow-all-to-current-assume_role/common_vars.yaml; this function works only with files that are distributed as part of the configuration source code, so if this file will be created by a resource in this configuration you must instead obtain this result from an attribute of that resource. (and 21 elided errors)

and the command i run is

terramate list --changed

Environment (please complete the following information):

  • OS: macOS & Ubuntu
  • Terramate Version: 0.11.4
@parisnakitakejser parisnakitakejser added the bug Something isn't working label Dec 8, 2024
@i4ki
Copy link
Contributor

i4ki commented Dec 9, 2024

Hey @parisnakitakejser

Thank you for reporting this.

In this line /infrastructure/prod/terragrunt.hcl:2,36-52, are you using a relative or an absolute path?

And, is this path correct? /Users/pnk/Developer/{repo}/infrastructure/prod/eu-west-1/iam-policys/sts-allow-all-to-current-assume_role/common_vars.yaml
Asking this because maybe Terramate is using a wrong baseDir in the file() function (if you are using a relative path).

@parisnakitakejser
Copy link
Author

my terragrunt file look like this

locals {
    common_vars = yamldecode(file("common_vars.yaml"))

    # TF State
    tfstate_global_bucket = local.common_vars.tfstate_global_bucket
    tfstate_global_bucket_region = local.common_vars.tfstate_global_bucket_region
    tfstate_dynamodb_table = local.common_vars.tfstate_dynamodb_table
}


remote_state {
    backend = "s3"
    config = {
        encrypt = true
        bucket = local.tfstate_global_bucket
        key    = "{brand}.aws.infrastructure/prod/${path_relative_to_include()}/terraform.tfstate"
        region = local.tfstate_global_bucket_region
        dynamodb_table = local.tfstate_dynamodb_table
    }

    generate = {
        path        = "backend.tf"
        if_exists   = "overwrite_terragrunt"
    }
}

@i4ki i4ki linked a pull request Dec 10, 2024 that will close this issue
@i4ki
Copy link
Contributor

i4ki commented Dec 10, 2024

Thanks for the details.

Can you install this commit and execute with debug enabled?

go install github.com/terramate-io/terramate/cmd/terramate@3cd7fea1f592a00ce209189f2fc28fa49bfeea1b

The line below filters to only the lines that I'm interested in:

terramate list --changed --log-level=debug 2>&1 | grep 'terragrunt::file'

Then post the output here.
If there are multiple file() calls, please only keep the one with the issue.

Thank you for the help!

@i4ki
Copy link
Contributor

i4ki commented Dec 10, 2024

Feel free to reach out to me in our Discord server, if you wish to send as a DM.
My username is _i4k.

@i4ki
Copy link
Contributor

i4ki commented Jan 7, 2025

hey @parisnakitakejser

Can you fork and open a PR in the repo below adding a file() call which reproduces the issue?
https://github.com/terramate-io/terramate-terragrunt-infrastructure-live-example

or you can create another public repo, just to reproduce this, but make sure using terramate list --changed reproduces it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants