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
Configure provider from *.tfvars #23340
Comments
A good option could be to save the provider config params into state file and reuse it on the next run instead of asking a user. |
Thanks for sharing this use-case, @timurb! As a way to get something like what you're looking for today, note that the The way to configure provider arguments with variable "aws_region" {
type = string
}
provider "aws" {
region = var.aws_region
} At this time we don't have plans to save provider configuration to the state because provider configuration often contains credentials that are specific to a particular user and not re-usable between different users working with the same state. However, it might be an acceptable compromise to store those input values in a local directory (never persisted to remote state storage) so that a particular user only has to enter them once. For settings like |
That's why I've created this ticket. Using env var Thanks! |
I am voting for the same feature.
There's no explicit provider definition in our code, because it's assumed by resource names. And normally credentials are passed via Gitlab ENV variables. But for the local tests we want to have a way to keep the creds file and use it as a regular tfvfars. |
Current Terraform Version
Use-cases
It would be nice if I could specify configuration for provider using
*.tfvars
file (or env variables could probably also work).Currently I have to either make that configuration explicit or type configuration manually each time. I'm talking specifically about the case when I have no
provider
blocks in my configuration and Terraform pulls the provider implicitly.Attempted Solutions
When I have AWS resources and don't have provider defined every time I run
terraform apply
I get the following message:If I try to put
provider.aws.region
toterraform.tfvars
I get the following error:Proposal
As a user I would expect that I'm able to use parameter name specified on input label
provider.aws.region
as my variable.It could reduce confusion if that label is displayed differently. I'd really like to be able to configure providers using
terraform.tfvars
References
There is a similar issue relating to backends, feel free to close this one if you feel they are the same: #19300
The text was updated successfully, but these errors were encountered: