Using Allowed Account + Profile provider causes in some cases creation of empty config AWS Provider

So I have a very simple configuration:

provider “aws” {
profile = var.account_id
allowed_account_ids = [var.account_id]
region = var.region
}

together with resource to read kubernetes stuff:

data “aws_eks_cluster” “kubernetes” {
name = var.cluster_name
}

For w/e reason instead of using available provider terraform creates a new one:

2022-02-07T22:05:39.435+0100 [TRACE] BuiltinEvalContext: Initialized "provider["Terraform Registry provider for provider[“Terraform Registry”]
2022-02-07T22:05:39.435+0100 [TRACE] provider.stdio: waiting for stdio data
2022-02-07T22:05:39.435+0100 [TRACE] buildProviderConfig for provider[“Terraform Registry”]: no configuration at all

Why that’s the case ? The kubernetes is in the same account as the provider is configured for?

2 Likes

And ofcourse it fails with:
│ Error: Missing required argument

│ The argument “region” is required, but was not set.
Due to “no configuration” provider.