terraform-provider-argocd
terraform-provider-argocd copied to clipboard
username, password, auth_token shouldn't be mandatory
If the option to read the parameters from environment variables is present, the requirement of having username/password or auth_token shouldn't be enforced.
terraform validate
will raise a validation issue if I don't set any through the provider definition, but have an environment variable with the value.
Somehow related to https://github.com/oboukili/terraform-provider-argocd/issues/83
I have never personally used username/password or auth_token from the provider arguments, always used the environment variables instead, can you give an example of what you are actually encountering?
For example, if I have a workspace set up and I run terraform validate
, I will get the error.
The workaround is to set the environment variable for the auth token on my computer to any value.
We have a pre-commit hook linting and validating the code from the workspace before a commit and on push events in the repo.
When planning/applying it does work okay because the variable for the auth token is populated in terraform cloud.
The workaround is to set the environment variable for the auth token on my computer to any value.
I guess we could add a logic inside the provider code and out of the provider schema spec. I'll see what I can do.
Hi @kmai,
I am doing some cleanup on open issues on this repository. Has this issue been resolved? I have tried to reproduce but am unable to do so. E.g. using the following Terraform code:
terraform {
required_providers {
argocd = {
source = "oboukili/argocd"
version = ">= 5.0.0"
}
}
}
provider "argocd" {}
resource "argocd_project" "foo" {
metadata {
name = "foo"
namespace = "argocd"
}
spec {
description = "foo"
source_repos = ["*"]
destination {
server = "https://kubernetes.default.svc"
namespace = "*"
}
}
}
If I run terraform validate
then I get:
$ terraform validate
Success! The configuration is valid.
If I run terraform plan
(with no env vars set) then I get the expected error:
╷
│ Error: Missing required argument
│
│ on versions.tf line 14, in provider "argocd":
│ 14: provider "argocd" {
│
│ The argument "server_addr" is required, but no definition was found.
╵
This issue is stale because of a lack of response from the original author. Please provide the requested feedback or this will be closed in 10 days.