I’m using Drone for my CI/CD pipeline. I’ve configured it to generate environment variables that contains my secrets for AWS.
I’ve follewed the documentation regarding environment variables and as far as I can tell, they should be visible to terraform.
Is there a way I can verify this somehow. Here is my code:
#james bennett1
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.0"
}
}
}
variable "AWS_ACCESS_KEY_ID" {
default = ""
}
variable "AWS_SECRET_ACCESS_KEY" {
default = ""
}
# Configure the AWS Provider
provider "aws" {
region = "us-east-1"
access_key = "${var.AWS_ACCESS_KEY_ID}"
secret_key = "${var.AWS_SECRET_ACCESS_KEY}"
}
resource "aws_s3_bucket" "bmw-bucket-a" {
bucket = "my-tf-test-bucket"
acl = "private"
tags = {
Name = "MW test big Bucket"
Environment = "Dev"
}
}
#}
The error when I run the code is
Error: NoCredentialProviders: no valid providers
caused by: EnvAccessKeyNotFound: failed to find credentials in the environment.