Authenticate into multiple regions

I am trying to launch EKS with Karpenter through Terraform using this template: https://github.com/aws-ia/terraform-aws-eks-blueprints/tree/main/patterns/karpenter

Since the public ECR repo needs to be accessed on us-east-1 (aws ecr-public is region specific · Issue #5917 · aws/aws-cli · GitHub and amazon web services - Could not connect to the endpoint URL: "https://api.ecr-public.xxxxxxxxx.amazonaws.com/" - Stack Overflow), I need to add an additional provider into my main.tf folder specifiying us-east-1 and calling that when trying to pull the image.

provider "aws" {
  region = local.region
}

provider "aws" {
  region = "us-east-1"
  alias  = "virginia"
}

Without this other “virginia” alias, GitLab runs the CI/CD pipeline fine using my IAM access key credentials in a different region. However it doesnt get past the build stage here when I have this extra provider since I do not have us-east-1 access and secret keys. Moving regions is unfortunately not an option.

The specific error is a No Valid Credentials Found error similar to one when access keys aren’t set up correctly.

How do you set AWS credentials? I am mostly using the environment variables and it works fine even with aliases (I have 4 of them).

I also authenticate using the environmental variables and the AWS IAM Secret Access Key and Key ID. However I can’t make a us-east IAM since this is a work environment stuck in the region I’m in. Wondering if I can find a way to authenticate Gitlab into that us-east-1 temporarily without providing those IAM credentials.