-
Notifications
You must be signed in to change notification settings - Fork 214
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
Terraform Fails to Create Okta Group Rule Due to "Empty Access Token" #2161
Comments
I also did something like this in the provider to pass in the private_key to confirm this issue:
This is what happens:
|
Edit: I'm not OP, but my manifestation of this was a me-problem: passing a non-empty, incorrect value to I am having the same issue using Terraform Stacks with an Edit: This is also using v4.12.0 of the provider. Deployment Config# Note: All variables loaded from a variable set in this way are marked as `ephemeral`.
# To my knowledge there is no other way to read secrets from a variable set using Terraform Stacks.
store "varset" "vendor_okta" {
id = "varset-<redacted>"
category = "terraform"
}
deployment "<redacted>" {
inputs = {
okta_organization = store.varset.vendor_okta.organization
okta_client_id = store.varset.vendor_okta.client_id
okta_private_key_id = store.varset.vendor_okta.key_id
okta_private_key = store.varset.vendor_okta.key
# etc ...
}
} Stack configprovider "okta" "singleton" {
config {
base_url = "okta.com"
org_name = var.okta_organization
client_id = var.okta_client_id
private_key_id = var.okta_private_key_id
private_key = var.okta_private_key
scopes = [
"okta.apps.manage",
"okta.apps.read",
"okta.groups.read",
"okta.policies.read",
]
}
}
variable "okta_organization" {
description = "The name of the Okta organization."
type = string
ephemeral = true
}
variable "okta_client_id" {
description = "The client ID for the 'Terraform Provider' Okta application."
type = string
ephemeral = true
}
variable "okta_private_key_id" {
description = "The ID of the public/private key pair for the 'Terraform Provider' Okta application."
type = string
ephemeral = true
}
variable "okta_private_key" {
description = "The private key for the 'Terraform Provider' Okta application."
type = string
sensitive = true
ephemeral = true
} |
Well, this is embarrassing - I was passing the wrong value for |
@ronballesteros I have been using OAuth2 without issue. From you comments, it seems like the server is trying to get the access token without success. A couple things you can try is
You can also try to run |
Community Note
Terraform Version
Affected Resource(s)
Terraform Configuration Files
Debug Output
Panic Output
Expected Behavior
Terraform should have applied the rule config.
Can this be done in the Admin UI?
Yes, but we want to control this via TF
Can this be done in the actual API call?
Actual Behavior
When attempting to create an Okta group rule using Terraform (with using the private-key), the process fails with the following error:
This issue occurs during the execution of terraform apply, despite the fact that:
Terraform validates the private key and does not flag it as invalid.
When running the same Terraform configuration with an invalid private key, the error explicitly states:
This indicates that the private key in use is potentially valid. However, the Terraform provider is unable to generate or utilize a valid access token to communicate with Okta's API.
If we don't provide the private_key in the github action env var (secret), it defaults to looking for a token and the tf plan fails:
Steps to Reproduce
Important Factoids
Shouldn't I be able to run terraform apply using the okta-provider with just the private-key and no access token?
References
The text was updated successfully, but these errors were encountered: