Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error configuring Terraform AWS Provider #14450

Open
RamanaChowdam opened this issue Aug 3, 2020 · 12 comments
Open

error configuring Terraform AWS Provider #14450

RamanaChowdam opened this issue Aug 3, 2020 · 12 comments
Labels
bug Addresses a defect in current functionality. provider Pertains to the provider itself, rather than any interaction with AWS. upstream Addresses functionality related to the cloud provider.

Comments

@RamanaChowdam
Copy link

i have Terraform v0.12.28

  • provider.aws v3.0.0
  • provider.null v2.1.2

when i run terraform apply and plan it giving below error
error configuring Terraform AWS Provider: Error creating AWS session: SharedConfigLoadError: failed to load config file, /home/wavemaker/.aws/config
caused by: INIParseError: invalid state with ASTKind {completed_stmt {0 NONE 0 []} false [{section_stmt {1 STRING 0 [78 111 110 101]} true []}]} and TokenType op

on main.tf line 1, in provider "aws":
1: provider "aws" {

but i am passing access_key and secret_key using env variables to the terraform main file

@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Aug 3, 2020
@ewbankkit
Copy link
Contributor

@RamanaChowdam
Copy link
Author

Similar:

but i didn't have any session token details in my config file

@Andrew13648
Copy link

@RamanaChowdam If I had to guess, I think the issue is with having a null/None value in your config file and not specifically tied to a session token (if you run an ASCII to text converter for 078 111 110 101 you get a value of None). Do you have any None values / blank values set in your config file?

@lispnik
Copy link

lispnik commented Aug 26, 2020

I had a fairly new awscli installation and my ~/.aws/config had nonsense like (literally):

[default]
aws_secret_access_key = [secretKey]
...

My credentials where in ~/.aws/credentials, of course. Removing the offending lines allows the INIParser to proceed.

The error message is pretty brutal though.

@e-power
Copy link

e-power commented Aug 27, 2020

So this also breaks when you have valid config i.e. in ~/.aws/config file

cli_pager=

Which sends aws command output to STDOUT.

Am I going to have comment this out every time I wish to run terraform vs awscli?

@bflad
Copy link
Contributor

bflad commented Aug 27, 2020

Hi folks 👋 Any issues with parsing AWS configuration files, such as incorrect handling with certain options or hard to understand INIParseError errors, will need bug reports filed upstream in the AWS Go SDK. The Terraform AWS Provider is wholly dependent on the AWS Go SDK to properly work with INI files that are also supported by other AWS SDKs and the AWS CLI (boto/Python).

@bflad bflad added bug Addresses a defect in current functionality. upstream Addresses functionality related to the cloud provider. provider Pertains to the provider itself, rather than any interaction with AWS. and removed needs-triage Waiting for first response or review from a maintainer. labels Aug 27, 2020
@KaibaLopez
Copy link

Hi, It might be a matter of updating the dependencies on the project, this problem should already have been fixed as of version 1.35 of the Go SDK. Here's the PR that fixes it.

@dimisjim
Copy link
Contributor

dimisjim commented Jan 28, 2021

@KaibaLopez This doesn't seem to be the case: aws/aws-sdk-go#3756 (comment)

@dimisjim
Copy link
Contributor

dimisjim commented Feb 4, 2021

@bflad

The issue can be fixed if one adds a newline at the end of their .aws/config file: aws/aws-sdk-go#3756 (comment)

@llamafilm
Copy link

I had this problem due to some junk characters in the config file

@github-actions
Copy link

Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.

If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!

@github-actions github-actions bot added the stale Old or inactive issues managed by automation, if no further action taken these will get closed. label Feb 10, 2023
@sleonardprove
Copy link

This issue may be stale, but it is still a problem.

@github-actions github-actions bot removed the stale Old or inactive issues managed by automation, if no further action taken these will get closed. label Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Addresses a defect in current functionality. provider Pertains to the provider itself, rather than any interaction with AWS. upstream Addresses functionality related to the cloud provider.
Projects
None yet
Development

No branches or pull requests

10 participants