Hello
I facing this fellow error when i trying to run terraform apply from backend file knowing that the terraform project well initiated.
│ Error: Failed to parse command-line flags
│
│ flag provided but not defined: -backend-config
╵
For more help on using this command, run:
terraform apply -help
1 Like
Hey @dahache.salah,
From the error message I can see that you’ve used the terraform apply
command with the -backend-config
flag. The -backend-config
flag is meant for use with terraform init
. This command initializes Terraform by downloading the required providers, configuring the backend, and more. The backend configuration is only needed during the init
phase of Terraform, not during the plan or apply.
Examples of using the -backend-config
flag with a file:
$ terarform init -backend-config=env/dev/backend-config.tf
If you have any follow-up questions, let me know!
Hi bschaatsbergen,
Yes exactly what I do, I initialized the terraform from backend configuration file
terraform init -backend-config=environnement/deploy.dynamic.http.tfbackend
Hey @dahache.salah,
You only need to include the -backend-config
flag during the initialization phase of Terraform. It’s neither supported nor intended to be included as part of a terraform plan
or terraform apply
. Does this answer your question accordingly?