Is there any way to get more information about why...
# infisical-help
h
Is there any way to get more information about why an OIDC authentication from Terraform Cloud to Infisical is failing? I have the following provider definition:
Copy code
provider "infisical" {
  host = "https://eu.infisical.com"
  auth = {
    oidc = {
      token_environment_variable_name = "TFC_INFISICAL_WORKLOAD_IDENTITY_AUDIENCE"
    }
  }
}
I set
TFC_INFISICAL_WORKLOAD_IDENTITY_AUDIENCE
as an env var for my workspace, I set
INFISICAL_MACHINE_IDENTITY_ID
as an env var for the correct machine identity id, but when I run TFC on my pull request it gets the following error:
Copy code
Error: Unable to Create Infisical API Client
with provider["registry.terraform.io/infisical/infisical"]
on terraform.tf line 27, in provider "infisical":

provider "infisical" {

An unexpected error occurred when creating the Infisical API client. If the error is not clear, please get in touch at infisical.com/slack.

Infisical Client Error: unable to authenticate with machine identity [err=CallOidcMachineIdentityAuth Unsuccessful response [POST https://eu.infisical.com/api/v1/auth/oidc-auth/login] [status-code=401] [request-id=req-swEYY3eehkFk2X] [message="Invalid JWT"]]
There's nothing in my audit logs related to this. The "glob pattern" that we are able to use for subjects isnt documented or an example given anywhere, what I'm doing is:
Copy code
organization:<org>:project:<project>:workspace:<workspace>:run_phase:*
d
Here the same experience with OIDC for gitlab. Full subject is working, glob patterns not. BranchName must be flexible, but replace with * gives [message="Access denied: OIDC subject not allowed."].
h
ok I got it to work for me, I was confused about the audience env var vs the token env var. I thought I just needed to provide any env var for the audience but I needed to to provide an env var for the audience with a specific naming convention which would result in a token env var with another naming convention This works for me:
Copy code
provider "infisical" {
  host = "https://eu.infisical.com"
  auth = {
    oidc = {
      token_environment_variable_name = "TFC_WORKLOAD_IDENTITY_TOKEN_INFISICAL"
    }
  }
}
and setting
TFC_WORKLOAD_IDENTITY_AUDIENCE_INFISICAL
as an env var in TFC
the glob pattern is working for my subject in TFC tho @Danny De Clercq
d
ok, I'll make a new tread for my problem
👍 1