Hi folks,
I’m experiencing some difficulty with creating resources in AWS via Terraform and was hoping somebody could help. FYI, I am using:
Terraform v0.12.26
provider.aws v2.67.0
My IAM user has full admin privileges and programmatic access but when i try to create a resource i.e. VPC i get teh following error:
Warning: Interpolation-only expressions are deprecated
on provider.tf line 2, in provider “aws”:
2: region = “${var.aws_region}”To silence this warning, remove the “${ sequence from the start and the }”
aws_vpc.my_vpc: Creating…
Error: Error creating VPC: AuthFailure: AWS was not able to validate the provided access credentials
status code: 401, request id: 828ad3fe-8c39-4fdc-b3a8-5c22f25909a7on network.tf line 1, in resource “aws_vpc” “my_vpc”:
1: resource “aws_vpc” “my_vpc” {
My provider file is set up like below:
provider “aws” {
region = “${var.aws_region}”
access_key = “var.aws_access_key”
secret_key = “var.aws_secret_key”
version = “~> 2.67”
skip_credentials_validation = true
skip_requesting_account_id = true
}
Terraform init and Terraform Plan work fine. I had to add the 2 “skip” statements in above to get past “Terraform Plan” which previously I did not have to do. It has been about 4 months since i last used Terraform and i have upgraded versions since. I am not using AWS configure but instead hard-coding my access/secret keys in a variables file in clear text for testing purposes.
Some questions:
a) Is this a version issue?
b) If i remove the $ and {} from the region variable above my “Terraform Plan” fails but the irony is there is a warning above suggesting that this has been deprecated in the latest versions of Terraform. Is this a bug?
c) I am just about to start building out a production environment so though the latest versions would be best. If this is not the case, can you recommend stable terraform and provider versions?
Any help would be much appreciated.