Fixing "The specified custom plugin is for a different region. Please try the request in [region]" cover image

Fixing "The specified custom plugin is for a different region. Please try the request in [region]"

Daniel Tharp • December 9, 2022

aws terraform

I'm still getting used to certain quirks and nuances of a new job, and in some recent work on moving an AWS MSK cluster to multi-region, I was also working on setting up MirrorMaker 2. In trying to run terraform to import some stuff I made via the console, I got a fun error message back:

BadRequestException: The specified custom plugin is for a different region. Please try the request in [region]. 

What was weird here, was that I had a provider block set for this region already, and this resource was making use of it.

This was actually a simple thing, it just wasn't immediately intuitive. Terraform was actually being called from behind aws-vault, and that makes use of your ~/.aws/config block. Specifically, it makes use of the profiles in that file, and completely ignores anything in the [default] section.

So, fixing this in my case was as simple as:

aws configure set region us-west-2 --profile [profile]

No flushing of credentials were needed or anything like that, it just worked after that.

Hope that saves you a few minutes.