terraform-provider-fortios icon indicating copy to clipboard operation
terraform-provider-fortios copied to clipboard

https://registry.terraform.io/providers/fortinetdev/fortios/latest/docs/resources/fortios_system_apiuser#api_key not working

Open agyss opened this issue 1 year ago • 2 comments

https://registry.terraform.io/providers/fortinetdev/fortios/latest/docs/resources/fortios_system_apiuser#api_key

does not seem to be working at all, meaning

terraform output api_token

does not return any value but fails with an error (output not found).

If i refernece the api key in an output, like:

resource "fortios_system_apiuser" "api_user" {
  name       = "api_user_test"
  accprofile = fortios_system_accprofile.api_user_access_profile.testProfile
  vdom {
    name = "root"
  }
}


output "api_token" {
  sensitive = true
  value     = fortios_system_apiuser.api_user.api_key
}

no output is generated and I can't access the value at all.

Changing it to

resource "fortios_system_apiuser" "api_user" {
  name       = "api_user_test"
  accprofile = fortios_system_accprofile.api_user_access_profile.testProfile
  api_key = "test234TestTesdT"

  vdom {
    name = "root"
  }
}

I get this error:

│ Error: Error updating SystemApiUser resource: Internal Server Error - Internal error when processing the request (500)
│ Cli response: 
│ node_check_object fail! for api-key *
│ 
│ value parse error before '*'
│ Command fail. Return code -37
│ 
│ 
│   with fortios_system_apiuser.api_user,
│   on primary_instance.tf line 182, in resource "fortios_system_apiuser" "api_user":
│  1: resource "fortios_system_apiuser" "api_user" {
```

However, in this case `terragrunt output api_token` would return a value - which, however, was not applied.

agyss avatar Dec 01 '23 15:12 agyss