[GH-ISSUE #177] Bug: multiple --varfile parameters ignored, only first is read. #104

Closed
opened 2026-05-06 12:37:31 +02:00 by BreizhHardware · 2 comments

Originally created by @adamcheney on GitHub (Mar 23, 2026).
Original GitHub issue: https://github.com/patrickchugh/terravision/issues/177

The CLI correctly adds multiple --varfile parameters to a List[str] but then only considers varfile[0]. This causes plan errors in terraform environments that use multiple varfiles.

MRE:


> mkdir MRE && CD MRE

> cat > main.tf << EoT                                  
provider "aws" {
  region                      = "us-east-1"
  skip_credentials_validation = true
  skip_requesting_account_id  = true
  access_key                  = "mock"
  secret_key                  = "mock"
}
variable "x" {}
variable "y" {}
resource "aws_instance" "test" {
  ami           = var.x
  instance_type = var.y
}
EoT

> cat > a.tfvars << EoV                                  
x=1
EoV

> cat > b.tfvars << EoV                                  
y=2
EoV

> terravision draw --varfile a.tfvars --varfile b.tfvars


 _____                          _     _             
/__   \___ _ __ _ __ __ ___   _(_)___(_) ___  _ __  
  / /\/ _ \ '__| '__/ _` \ \ / / / __| |/ _ \| '_ \ 
 / / |  __/ |  | | | (_| |\ V /| \__ \ | (_) | | | |
 \/   \___|_|  |_|  \__,_| \_/ |_|___/_|\___/|_| |_|



Preflight check..
  dot command detected: /opt/homebrew/bin/dot
  gvpr command detected: /opt/homebrew/bin/gvpr
  git command detected: /usr/bin/git
  terraform command detected: /opt/homebrew/bin/terraform
  terraform version detected: Terraform v1.14.7



Calling Terraform..
  Forcing temporary local backend to generate full infrastructure plan
Initializing the backend...

Successfully configured the backend "local"! Terraform will automatically
use this backend unless the backend configuration changes.
Initializing provider plugins...
- Finding latest version of hashicorp/null...
- Installing hashicorp/null v3.2.4...
- Installed hashicorp/null v3.2.4 (signed by HashiCorp)
Terraform has created a lock file .terraform.lock.hcl to record the provider
selections it made above. Include this file in your version control repository
so that Terraform can guarantee to make the same selections by default when
you run "terraform init" in the future.

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.

Initalising workspace: default


Generating Terraform Plan..

var.y
  Enter a value:
Originally created by @adamcheney on GitHub (Mar 23, 2026). Original GitHub issue: https://github.com/patrickchugh/terravision/issues/177 The CLI correctly adds multiple `--varfile` parameters to a `List[str]` but then only considers `varfile[0]`. This causes plan errors in terraform environments that use multiple varfiles. MRE: ``` > mkdir MRE && CD MRE > cat > main.tf << EoT provider "aws" { region = "us-east-1" skip_credentials_validation = true skip_requesting_account_id = true access_key = "mock" secret_key = "mock" } variable "x" {} variable "y" {} resource "aws_instance" "test" { ami = var.x instance_type = var.y } EoT > cat > a.tfvars << EoV x=1 EoV > cat > b.tfvars << EoV y=2 EoV > terravision draw --varfile a.tfvars --varfile b.tfvars _____ _ _ /__ \___ _ __ _ __ __ ___ _(_)___(_) ___ _ __ / /\/ _ \ '__| '__/ _` \ \ / / / __| |/ _ \| '_ \ / / | __/ | | | | (_| |\ V /| \__ \ | (_) | | | | \/ \___|_| |_| \__,_| \_/ |_|___/_|\___/|_| |_| Preflight check.. dot command detected: /opt/homebrew/bin/dot gvpr command detected: /opt/homebrew/bin/gvpr git command detected: /usr/bin/git terraform command detected: /opt/homebrew/bin/terraform terraform version detected: Terraform v1.14.7 Calling Terraform.. Forcing temporary local backend to generate full infrastructure plan Initializing the backend... Successfully configured the backend "local"! Terraform will automatically use this backend unless the backend configuration changes. Initializing provider plugins... - Finding latest version of hashicorp/null... - Installing hashicorp/null v3.2.4... - Installed hashicorp/null v3.2.4 (signed by HashiCorp) Terraform has created a lock file .terraform.lock.hcl to record the provider selections it made above. Include this file in your version control repository so that Terraform can guarantee to make the same selections by default when you run "terraform init" in the future. 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. Initalising workspace: default Generating Terraform Plan.. var.y Enter a value: ```
Author
Owner

@patrickchugh commented on GitHub (Mar 24, 2026):

Hi @adamcheney can you try with the latest version v0.24 and let me know if this can be closed?

<!-- gh-comment-id:4120499408 --> @patrickchugh commented on GitHub (Mar 24, 2026): Hi @adamcheney can you try with the latest version v0.24 and let me know if this can be closed?
Author
Owner

@adamcheney commented on GitHub (Mar 24, 2026):

Oh, yeah, awesome - I was literally minutes away from a PR!

Cheers - Adam...

On Tue, 24 Mar 2026, 18:31 Patrick Chugh, @.***> wrote:

patrickchugh left a comment (patrickchugh/terravision#177)
https://github.com/patrickchugh/terravision/issues/177#issuecomment-4120499408

Hi @adamcheney https://github.com/adamcheney can you try with the
latest version v0.24 and let me know if this can be closed?


Reply to this email directly, view it on GitHub
https://github.com/patrickchugh/terravision/issues/177?email_source=notifications&email_token=AIXTDQN5CMUO4LM4UQBVF5D4SLH7VA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIMJSGA2DSOJUGA4KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-4120499408,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AIXTDQLSGHZOLYYWDDVANET4SLH7VAVCNFSM6AAAAACW4K4QTKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DCMRQGQ4TSNBQHA
.
You are receiving this because you were mentioned.Message ID:
@.***>

<!-- gh-comment-id:4121284186 --> @adamcheney commented on GitHub (Mar 24, 2026): Oh, yeah, awesome - I was literally minutes away from a PR! Cheers - Adam... On Tue, 24 Mar 2026, 18:31 Patrick Chugh, ***@***.***> wrote: > *patrickchugh* left a comment (patrickchugh/terravision#177) > <https://github.com/patrickchugh/terravision/issues/177#issuecomment-4120499408> > > Hi @adamcheney <https://github.com/adamcheney> can you try with the > latest version v0.24 and let me know if this can be closed? > > — > Reply to this email directly, view it on GitHub > <https://github.com/patrickchugh/terravision/issues/177?email_source=notifications&email_token=AIXTDQN5CMUO4LM4UQBVF5D4SLH7VA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIMJSGA2DSOJUGA4KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-4120499408>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AIXTDQLSGHZOLYYWDDVANET4SLH7VAVCNFSM6AAAAACW4K4QTKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DCMRQGQ4TSNBQHA> > . > You are receiving this because you were mentioned.Message ID: > ***@***.***> >
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/terravision#104
No description provided.