[solved] Non-existent provider initiation: hashicorp/api

Hi there,

I’m getting a very weird error:

Failed to initiate provider "registry.terraform.io/hashicorp/api" 
to obtain schema: Unknown provider "registry.terraform.io/hashicorp/api"

when using api_gateway_base_path_mapping. AFAICS, there is no such provider called: hashicorp/api and I cannot find any reference to it either.

the resource definition that I’m using is very simple:

resource "aws_api_gateway_base_path_mapping" "gw_mapping" {
  api_id      = aws_api_gateway_rest_api.gw_api.id
  domain_name = aws_api_gateway_domain_name.gw_domain.domain_name
  stage_name  = aws_api_gateway_stage.gw_stage.stage_name

and the error goes away the moment I comment out this section. Does anyone have any idea what’s going on here? Is it a bug TF/Provider or am I missing something here. Any help will be very much appreciated.


Usually this can happen if a resource is not properly prefixed. So you might want to check your code if there’s a resource like api_gateway_base_path_mapping which is not prefixed with aws_.

thanks @tbugfinder
So silly of me ; still cannot believe I missed the aws_ bit in the front. Good catch.
But I learned something today, to remember :+1: