'pip vendor certifi handle is invalid

The following may be due to the fact that I messed something regarding a SSL certificate up on my local machine? I encounter the issue during Terraform plan but maybe I need to reissue/install a certificate?

I use Visual Studio code in Windows and setup my AWS credentials/profile fine using the AWS CLI. I have this Main.tf file :

provider "aws" {
    region = "eu-west-2"
    shared_config_files = ["C:\\Users\\blabla\\.aws\\config"]
    shared_credentials_files = ["C:\\Users\\blabla\\.aws\\credentials"]
    profile = "default"
}  

resource "aws_s3_bucket" "b" {
    bucket = "amazing-bucket"
}
  

I ran terraform init but after terraform plan I get:

│ Error:  Error: error configuring Terraform AWS Provider: loading configuration: read C:\Users\blabla\env\Lib\site-packages\pip\_vendor\certifi: The handle is invalid.
│
│   with provider["registry.terraform.io/hashicorp/aws"],
│   on Main.tf line 1, in provider "aws":
│    1: provider "aws" { 

What does this mean? Is it related to an SSL certificate? It may be a Python related issue as pip appears in the error message?

When I run the above not as admin the error message contains the folder C:\data\ Where does it take these folder names from? It is just really odd.

Thanks!

PS:

When I run:

import certifi
print(certifi.where())

it points to this folder in the Terraform error message. Why is it looking there in the first place?!

PPS:

when I deliberately enter a wrong path for shared_config_files I get:

Error: error configuring Terraform AWS Provider: failed to get shared config profile, default

This implies to me that shared_config_files points to the right place ...



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source