Skip to content
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

"parse content type: mime: invalid media parameter" error when using the provider #809

Open
4 tasks done
dotspec opened this issue Apr 5, 2024 · 1 comment
Open
4 tasks done
Labels
bug Something isn't working

Comments

@dotspec
Copy link

dotspec commented Apr 5, 2024

Readiness Checklist

  • I am running the latest version
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed
  • I am reporting the issue to the correct repository (for multi-repository projects)

Expected Behavior

Provider should return results when using data resources.

Current Behavior

When running terraform apply the provider errors out with Failed searching deployments version: parse content type: mime: invalid media parameter. The first part of the error will change depending on the data resource in use but the rest is always the same. This has previously worked just fine, it wasn't until trying to perform a run that we discovered the error. Probably worth noting that our deployment is in AWS govcloud which requires using a different endpoint URL in the provider config.

Initially I thought it was possible our API key rotated however after issuing a new one and verifying that a similar call using curl worked (curl -H "Authorization: ApiKey $EC_API_KEY" https://api.us-gov-east-1.aws.elastic-cloud.com/api/v1/deployments) I still wasn't able to get this to return anything via the provider. Here's the output of a plan.

data.ec_deployments.this: Reading...
╷
│ Error: Failed searching deployments
│
│   with data.ec_deployments.this,
│   on main.tf line 1, in data "ec_deployments" "this":
│    1: data "ec_deployments" "this" { }
│
│ Failed searching deployments version: parse content type: mime: invalid media parameter

## Terraform definition

Can't get much more basic

data "ec_deployments" "this" { }

provider "ec" {
  apikey   = var.ec_apikey
  endpoint = "https://api.us-gov-east-1.aws.elastic-cloud.com/"
  verbose = true
}

terraform {
  required_version = "1.2.7"
  required_providers {
    ec = {
      source  = "elastic/ec"
      version = "0.10.0"
    }
  }
}

Steps to Reproduce

  1. Generate an API key on a govcloud deployment.
  2. Set the key as the value for ec_apikey
  3. terraform apply

Context

This has stopped runs from working anywhere we use the provider. Maybe there's some subtle user error here but I think I've covered my bases at this point.

Your Environment

  • Version used: 0.10.1
  • Running against Elastic Cloud SaaS or Elastic Cloud Enterprise and version: Enterprise
  • Environment name and version (e.g. Go 1.9):
  • Server type and version:
  • Operating System and version:
  • Link to your project:
@dotspec dotspec added the bug Something isn't working label Apr 5, 2024
@tobio
Copy link
Member

tobio commented May 15, 2024

Thanks for reporting this @dotspec. This is an issue with the internal infrastructure within our Govcloud environment where an extra value is being injected into the Content-Type header (application/json; charset=utf-8,application/json vs application/json) causing an issue with the generated API client.

I've raised the issue internally to fix the invalid header value. In the meantime, it looks like this issue doesn't impact the console endpoint, so you can work around the issue by setting endpoint=https://console.us-gov-east-1.aws.elastic-cloud.com/.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants