clong / DetectionLab

Automate the creation of a lab environment complete with security tooling and logging best practices
MIT License
4.59k stars 979 forks source link

terraform issue, shared_credential_file #817

Closed julianwieg closed 2 years ago

julianwieg commented 2 years ago

Description of the issue:

When I plan or apply I get the following error, see below. I updated/checked the paths and yes of course the creds are there. Bit lost what the issue is as I even read the TF provider documentation and everything 'seems' fine (though I never learned TF before).

error

│ Warning: Argument is deprecated
│ 
│   with provider["registry.terraform.io/hashicorp/aws"],
│   on main.tf line 3, in provider "aws":
│    3:   shared_credentials_file = var.shared_credentials_file
│ 
│ Use shared_credentials_files instead.
│ 
│ (and one more similar warning elsewhere)
╵
╷
│ Error: error configuring Terraform AWS Provider: failed to get shared config profile, terraform
│ 
│   with provider["registry.terraform.io/hashicorp/aws"],
│   on main.tf line 2, in provider "aws":
│    2: provider "aws" {
│ 

variables.tf

variable "shared_credentials_file" {
  description = "Path to your AWS credentials file"
  type        = string
  default     = "~/.aws/credentials"
}

for me at least the above credentials files does work when I cat the path

main.tf

# Specify the provider and access details
provider "aws" {
  shared_credentials_file = var.shared_credentials_file
  region                  = var.region
  profile                 = var.profile
}
julianwieg commented 2 years ago

permissions... file permissions .aws was owned by root not by my user. Anyway another issue now but lets see if I can fix it