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

Too many command line arguments. Configuration path expected. #1617

Closed
ArturChe opened this issue Mar 29, 2021 · 3 comments
Closed

Too many command line arguments. Configuration path expected. #1617

ArturChe opened this issue Mar 29, 2021 · 3 comments

Comments

@ArturChe
Copy link

Hi!

There is an error 'Too many command line arguments. Configuration path expected.' when trying to call terragrunt run-all apply.
But at the same time the terragrunt apply works fine.

In debug mode I can see that terragrunt run-all apply has two additional arguments -auto-approve -input=false which are not present in terragrunt apply.

terragrunt version v0.28.15

@yorinasub17
Copy link
Contributor

It's a bit hard to debug this without more info. Can you provide the following?

  • Can you extract the terraform apply call that terragrunt makes from the logs of run-all apply which causes the error?

  • Can you paste the terraform block from your config, so we can see any extra_arguments you have configured?

Thanks!

@ArturChe
Copy link
Author

ArturChe commented Mar 30, 2021

Hi @yorinasub17 ,
Here are some details, let me know if you need more.

terragrunt.hcl

...
terraform {
  extra_arguments "plan" {
    commands  = ["plan"]
    arguments = [
      "-refresh=true",
      "-var-file=${get_terragrunt_dir()}/variables.tfvars",
      "-out=${get_terragrunt_dir()}/plan.bin"
    ]
  }
  
  extra_arguments "apply" {
    commands  = ["apply"]
    arguments = ["${get_terragrunt_dir()}/plan.bin"]
  }
  
  after_hook "remove_plan_after_apply" {
    commands     = ["apply"]
    execute      = ["rm", "${get_terragrunt_dir()}/plan.bin"]
    run_on_error = true
  }
}
...
$ terragrunt run-all apply --terragrunt-log-level debug --terragrunt-debug
...
INFO[0004] Debug mode requested: generating debug file terragrunt-debug.tfvars.json in working dir /a/b/c/d/cloudfront/development  prefix=[/a/b/c/d/cloudfront/development]
DEBU[0004] The following variables were detected in the terraform module:  prefix=[/a/b/c/d/cloudfront/development]
DEBU[0004] [web-acl-arn web-acl-topic-arn cloudfront-hosted-zone-name parent-hosted-zone-id env-name cloudfront-log-bucket-domain-name]  prefix=[/a/b/c/d/cloudfront/development]
DEBU[0004] Variables passed to terraform are located in "/a/b/c/d/cloudfront/development/terragrunt-debug.tfvars.json"  prefix=[/a/b/c/d/cloudfront/development]
DEBU[0004] Run this command to replicate how terraform was invoked:  prefix=[/a/b/c/d/cloudfront/development]
DEBU[0004]      terraform apply -auto-approve -input=false -var-file="/a/b/c/d/cloudfront/development/terragrunt-debug.tfvars.json" "/a/b/c/d/cloudfront/development"  prefix=[/a/b/c/d/cloudfront/development]
DEBU[0005] Running command: terraform apply /a/b/c/d/cloudfront/development/plan.bin -auto-approve -input=false  prefix=[/a/b/c/d/cloudfront/development]
Too many command line arguments. Configuration path expected.
DEBU[0005] Detected 1 Hooks                              prefix=[/a/b/c/d/cloudfront/development]
INFO[0005] Executing hook: remove_plan_after_apply       prefix=[/a/b/c/d/cloudfront/development]
DEBU[0005] Running command: rm /a/b/c/d/cloudfront/development/plan.bin  prefix=[/a/b/c/d/cloudfront/development]
ERRO[0005] Module /a/b/c/d/cloudfront/development has finished with an error: Hit multiple errors:
Hit multiple errors:
exit status 1  prefix=[/a/b/c/d/cloudfront/development]
...
$ terragrunt apply --terragrunt-log-level debug --terragrunt-debug
...
INFO[0001] Debug mode requested: generating debug file terragrunt-debug.tfvars.json in working dir /a/b/c/d/cloudfront/development
DEBU[0001] The following variables were detected in the terraform module:
DEBU[0001] [web-acl-arn web-acl-topic-arn cloudfront-hosted-zone-name parent-hosted-zone-id env-name cloudfront-log-bucket]
DEBU[0001] Variables passed to terraform are located in "/a/b/c/d/cloudfront/development/terragrunt-debug.tfvars.json"
DEBU[0001] Run this command to replicate how terraform was invoked:
DEBU[0001]      terraform apply -var-file="/a/b/c/d/cloudfront/development/terragrunt-debug.tfvars.json" "/a/b/c/d/cloudfront/development"
DEBU[0002] Running command: terraform apply /a/b/c/d/cloudfront/development/plan.bin

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

Outputs:
xxx
DEBU[0009] Detected 1 Hooks
INFO[0009] Executing hook: remove_plan_after_apply
DEBU[0009] Running command: rm /a/b/c/d/cloudfront/development/plan.bin

@yorinasub17
Copy link
Contributor

Ah thanks for the info. This is actually a duplicate of #1271. Please follow that issue to be notified when this gets resolved.

Closing as dup.

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

No branches or pull requests

2 participants