devans10 / terraform-provider-flash

Terraform provider plugin for Pure Storage FlashArray
Apache License 2.0
5 stars 10 forks source link

Import command throws 401 Response Code #19

Open mattivoxy opened 4 years ago

mattivoxy commented 4 years ago

Working on importing my current config, had already seen ticket #8 the recommends importing. Checked the source code for grabbiing the proper ID. Have put the following into my base main.tf:

resource "purestorage_host" "ESX-1" {
  provider = flash
  # (resource arguments)
}

And ran:

% terraform import purestorage_host.ESX-1 ESX-1
Acquiring state lock. This may take a few moments...
purestorage_host.ESX-1: Importing from ID "ESX-1"...
Error: Response code: 401, ResponeBody: []

This happens on any Pure resource I've tried so far (hosts, hostgroups). I have been able to create a standalone volume, so the initial inclination of 401 being "you ain't authorized, check your API key" seems to be a red herring as I do indeed have rights.

mattivoxy commented 4 years ago

Relevant output from TF_LOG=DEBUG:

2020-08-31T08:54:48.266-0700 [DEBUG] plugin.terraform-provider-flash_v1.1.2: 2020/08/31 08:54:48 [DEBUG] Pure Client configured for target: <pure hostname>
purestorage_host.ESXi-1: Importing from ID "ESXi-1"...
2020/08/31 08:54:48 [ERROR] eval: *terraform.EvalImportState, err: Response code: 401, ResponeBody: []
2020/08/31 08:54:48 [ERROR] eval: *terraform.EvalSequence, err: Response code: 401, ResponeBody: []