-
Notifications
You must be signed in to change notification settings - Fork 134
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
Opensearch 1.3 error "invalid character 'U' looking for beginning of value" #311
Comments
I'm getting the same error with the This is an example resource definition:
Error:
|
I ran the provider in debug mode and was able to find the issue (kinda). From my tests, the issue seems to be because it is only able to handle responses in JSON. In my case, I have a proxy in front of OpenSearch which was down, so making calls to OpenSearch (proxy) was returning a 404 from Nginx (which returns a |
Connection and credentials with the opensearch cluster work fine, because when we manage users using the provider it works without issue. I've tried to do a terraform plan with a clean tfstate and the plan works, it is when we try to do an apply that it still breaks with the aforementioned error. Sadly, running the provider in debug mode doesn't provide a more specific error:
|
@asepulcre you will need to run the provider in debug mode and attach a debugger to the process in order to use some breakpoints and check the variables (I know it's not an easy process but I think it's the only one in this case). What you want to find is the HTTP response that is breaking the JSON parse and thus throwing this error you see. |
Anyone able to find resolution for this issue? I am unable to run my build in debug mode. Below is my code. I was able to do the same when I use internal master user as the admin user but getting this error when iam role is the master user. provider "elasticsearch" { resource "elasticsearch_opensearch_roles_mapping" "mapper" { "Error: invalid character 'A' looking for beginning of value" - Error in the role mapping block. |
@psarun27 I think the overall issue which we all faced is that there's an error happening (a different one for each of us) and this error is not being returned in JSON, which is breaking the parsing from the provider and thus returning these generic errors. Unless there's a change on this provider to handle these cases (@phillbaker is that possible? I'm available to help if so) the only way to identify what is the real error you are facing is to run the provider in debug mode and find the HTTP response yourself. Note that I'm saying running the provider in debug mode, not terraform. |
Thank you, @raphael-caylent. Has anyone been able to create a user, role or do role mapping using this provider with an iam role as the master user. I am able to create user, role, and do role mapping if the master user is a internal database user but no luck if the master user is an iam role. My provider block is below. Am I missing anything here? Or there special permissions or configuration needed for the iam role? provider "elasticsearch" { Another question (somewhat related to the above question), please. I can run a below CURL command using a username/password (shown in bold below). How do I run the same command if the master user is an iam role? curl -XPUT "https://xxx.region.es.amazonaws.com/_plugins/_security/api/roles/newrole" -u "un:pwd" -k -H "Content-Type: application/json" -d {JSON} |
Looks like there is a newer version (2.0.5) which I used and got a detailed error message (helpful, thanks to all who contributed). Below is the recent error. Thoughts? @phillbaker @raphael-caylent Error: NoCredentialProviders: no valid providers in chain. Deprecated. |
I think in the beginning when I was trying to use this provider I tried to use an IAM Role but didn't work out so I switched to an internal user.
That's a good question, I need to think a bit on this one. But I guess what you could do is use a programming language that will give you a library to sign the request. Check this example. In this case, you could run your code in a Lambda that has the master role attached to it.
Maybe your TF role doesn't have permission to assume the master role? I would need more context on what |
Hey, I got the same Error After some careful log reading, I noticed that So I just went and added to Fixed the issue for me. |
Hi,
Recently we've updated our AWS Opensearch cluster from 1.2 to 1.3, we've been using your provider to manage users, policies, destinations and monitors, but with the update an error started to show up whenever we do a terraform plan or apply:
This is the resource configuration :
and an example of policy:
terraform config:
This error seems to occur whenever a json is involved, managing users works fine with version 1.3, but destinations, policies and monitors do not.
Any help is greatly appreciated, thanks in advance.
The text was updated successfully, but these errors were encountered: