Closed gfreit closed 1 month ago
I tried out this example but I'm getting a 401 error:
│ Error: GET (https://api.lumen.com/EdgeServices/v2/Compute/bareMetal/locations) failures reason (401 Unauthorized - {"exception" : {"httpStatusCode" : "401","code" : "401001","message" : "Unauthorized","detail" : "Failed-to-Authenticate"}})
│
│ with data.lumen_bare_metal_locations.locations,
│ on lumen-us-nashville.tf line 1, in data "lumen_bare_metal_locations" "locations":
│ 1: data "lumen_bare_metal_locations" "locations" {}
I also followed this guide on getting the access token via curl. I can get the access token just fine and the payload of that oauth/v2/token
says it's approved, but when I try to use the token in the sample API I'm seeing the same 401 unauthorized error. I also tried various combinations of including/excluding x-customer-number
and x-billing-account-number
but everything is resulting in a 401.
As of the latest release (v2.5.0), we now made v2 oauth the default for the apigee auth endpoint. If v2 oauth fails, then we try using v1 oauth. This should solve the problem for all users.
As we now support v2 oauth, I will be closing this issue. Thanks.
Documentation for API authentication (https://developer.lumen.com/apis/edge-bare-metal#authentication) uses https://api-test.lumen.com/oauth/v2/token (sandbox) and https://api.lumen.com/oauth/v2/token (production). When using my developer Apps generated Consumer Key and Consumer Secret on the My Apps page and run examples/data_source_bare_metal_locations, I get an error:
git/terraform-provider-lumen/examples/data_source_bare_metal_locations$ terraform apply ╷ │ Warning: Provider development overrides are in effect │ │ The following provider development overrides are set in the CLI configuration: │ - lumentech/lumen in /home/gfreiter/go/bin │ │ The behavior may therefore not match any released version of the provider and applying changes may cause the state to become incompatible with published releases. ╵ data.lumen_bare_metal_locations.locations: Reading... ╷ │ Error: apigee authentication failure │ │ with data.lumen_bare_metal_locations.locations, │ on main.tf line 16, in data "lumen_bare_metal_locations" "locations": │ 16: data "lumen_bare_metal_locations" "locations" {}
If I change the following to conform to above oauth/v2/token URL:
git/terraform-provider-lumen/lumen$ git diff diff --git a/lumen/client/bare_metal_client.go b/lumen/client/bare_metal_client.go index 83dae70..fb544ce 100644 --- a/lumen/client/bare_metal_client.go +++ b/lumen/client/bare_metal_client.go @@ -40,7 +40,7 @@ func NewBareMetalClient(apigeeBaseURL, consumerKey, consumerSecret, accountNumbe }) return &BareMetalClient{ URL: fmt.Sprintf("%s/EdgeServices/v2/Compute/bareMetal", apigeeBaseURL),
I get successful list of locations on a terraform apply for the bare metal locations example.