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

Dependency not being resolved in terraform block with run-all but works without run-all #2770

Closed
1 of 2 tasks
benjefferies opened this issue Oct 27, 2023 · 2 comments
Closed
1 of 2 tasks
Labels
bug Something isn't working stale Stale

Comments

@benjefferies
Copy link

benjefferies commented Oct 27, 2023

Describe the bug
dependency outputs not resolved in the terraform block when using terragrunt run-all plan but works with a terragrunt plan

To Reproduce

  1. Run terragrunt plan
  2. Run terragrunt run-all plan
dependency "eks" {
  config_path = "../eks"

  mock_outputs = {
    cluster_name = "placeholder"
    cluster_endpoint = "https://example.com"
    cluster_certificate_authority_data = dGVzdAo="
  }
}

generate "provider" {
  path = "provider.tf"
  if_exists = "overwrite_terragrunt"
  disable = true
  contents = <<EOF
provider "sops" {}
EOF
}

include {
  path = find_in_parent_folders()
}

terraform {
  source = dependency.eks.outputs.cluster_name != "placeholder" ? "../../../modules//argocd" : "git::https://github.com/vancluever/terraform-null-module.git?ref=44b7a3b"
}

inputs = {
  valuesFiles = ["values.yaml", "values-qa.yaml"]
}

Expected behavior
Both terragrunt run-all plan and terragrunt plan should resolve dependency in the terraform block

Nice to have

  • Terminal output
  • Screenshots

Versions

  • Terragrunt version:
  • Terraform version:
  • Environment details (Ubuntu 20.04, Windows 10, etc.):

Additional context

terragrunt run-all plan

terragrunt run-all plan --terragrunt-working-dir=infrastructure/envs/qa/argocd
ERRO[0000] Error processing module at '/Users/benjefferies/source/github/VEV-platform-services/vev-infrastructure/infrastructure/envs/qa/argocd/terragrunt.hcl'. How this module was found: Terragrunt config file found in a subdirectory of infrastructure/envs/qa/argocd. Underlying error: /Users/benjefferies/source/github/VEV-platform-services/vev-infrastructure/infrastructure/envs/qa/argocd/terragrunt.hcl:51,12-22: Unknown variable; There is no variable named "dependency"., and 1 other diagnostic(s) 
ERRO[0000] Unable to determine underlying exit code, so Terragrunt will exit with error code 1 

terragrunt plan

terragrunt plan --terragrunt-working-dir=infrastructure/envs/qa/argocd

Initializing the backend...

Initializing provider plugins...
- Reusing previous version of hashicorp/null from the dependency lock file
- Using previously-installed hashicorp/null v3.2.1

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # null_resource.resource will be created
  + resource "null_resource" "resource" {
      + id       = (known after apply)
      + triggers = {
          + "number" = "one"
        }
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Changes to Outputs:
  + null_resource_id = (known after apply)

─────────────────────────────────────────────────────────────────────────────

Note: You didn't use the -out option to save this plan, so Terraform can't
guarantee to take exactly these actions if you run "terraform apply" now.

It looks like it was previously fixed here #1257 and this is possibly related #2298

@benjefferies benjefferies added the bug Something isn't working label Oct 27, 2023
@benjefferies
Copy link
Author

Also see this comment #1276 (comment)

Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for raising this issue.

@github-actions github-actions bot added the stale Stale label Sep 25, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale Stale
Projects
None yet
Development

No branches or pull requests

1 participant