Problem:
When I attempt to create Sumo Logic collector using the Sumo Logic Terraform provider, I get the following error:
Error: collector with name my-collector not found:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 401 Full authentication is required to access this resource</title>
</head>
<body><h2>HTTP ERROR 401 Full authentication is required to access this resource</h2>
<table>
<tr><th>URI:</th><td>/api/v1/collectors/name/my-collector</td></tr>
<tr><th>STATUS:</th><td>401</td></tr>
<tr><th>MESSAGE:</th><td>Full authentication is required to access this resource</td></tr>
<tr><th>SERVLET:</th><td>rest</td></tr>
</table>
The provider is set as per Terraform documentation:
provider "sumologic" {
access_id = var.sumologic_access_id
access_key = var.sumologic_access_key
environment = "us2"
}
Cause:
- If the environmental variable for access id and access key has an error, then it will fail with 401 authentication error.
- If the user's account associated with the access id/key doesn't have the permissions to manage collectors, then the 401 authentication error will be seen.
- If the Environment variable is not set in Terraform provider(mains.tf) then the default will be taken as US2. If the user's account is in a different Sumo Logic deployment (us1, au, eu, ca, in, jp, etc...) then the collector API request will fail with a 401 authentication error.
Resolution:
- Please set your TF environment variables correctly
$ export SUMOLOGIC_ACCESSID="your-access-id"
$ export SUMOLOGIC_ACCESSKEY="your-access-key" - Make sure that the user account associated with the access id/key is enabled with permissions to Manage Collectors.
- Please set the environment variable to the proper deployment for your account:
$ export SUMOLOGIC_ENVIRONMENT=us2
After you log in to your account, you can determine the deployment from the URL in your browser.
Ex.https://service.<deployment>.sumologic.com
Note: if you do not see a <deployment> in your URL your account will be in the "us1" deployment.
Comments
0 comments
Please sign in to leave a comment.