-
Notifications
You must be signed in to change notification settings - Fork 244
Closed
Description
data "ibm_iam_auth_token" "restapi" {
}
provider "restapi" {
uri = "https://${local.base_endpoint}.${var.region}.secrets-manager.appdomain.cloud"
write_returns_object = true
debug = true
headers = {
Authorization = data.ibm_iam_auth_token.restapi.iam_access_token
Content-Type = "application/merge-patch+json"
}
}
I have this restapi provider and data block which fetches the token. I am getting an unauthorized 401 error because the http request using the resource block is made after 1 hour of run in terraform apply and by that time token gets expired. I am building an openshift cluster which usually takes more than an hour and after that step only restapi_object resource should run. I tried adding an explicit dependency on module.openshift in the data block to fetch the token but providers headers seem to initialise at the start and i still got the same error. Is there any way to handle this. Below is my restapi_object resource for reference.
resource "restapi_object" "delete_secret" {
id_attribute = "id"
path = "/api/v2/secrets/{id}"
read_path = "/api/v2/secrets/{id}"
read_method = "GET"
create_method = "PATCH"
create_path = "/api/v2/secrets/${local.secret_id}/metadata"
destroy_method = "DELETE"
destroy_path = "/api/v2/secrets/{id}"
data = jsonencode({})
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels