Assistance to create AWS resources using Terraform in AWS playground

I am writing to request assistance with an issue regarding AWS credentials when using Terraform.I am a Pro Plan subscriber.

I successfully retrieved the provided AWS Access Key ID and Secret Access Key for the designated user .

I configured the AWS CLI on Windows using the provided credentials and "us-east-1"region via aws configure.

I created my Terraform configuration file (.tf) for an EC2 resource, included the aws provider block specifying region = "us-east-1", and attempted to run the standard workflow.

    • terraform init (Completed successfully, provider downloaded).
  • terraform plan

When running terraform plan I receive an error indicating a credential issue

Could you please confirm the recommended and successful method for providing credentials to the Terraform AWS Provider in the Playground environment?

Any guidance or a working example configuration for creating a simple resource (like an S3 bucket or t2.micro EC2 instance) within the AWS Playground using Terraform would be highly appreciated.

Terraform does not use the aws cli to create resources. It has a built-in AWS client, i.e. it would work even if you do not have aws cli installed.

You need to set the access keys as environment variables before you run terraform.

In a PowerShell console, replacing these example keys with the ones you got.
You can set the region in the provider configuration in the terraform configuration file.

$env:AWS_ACCESS_KEY_ID = "AKIAIOSFODNN7EXAMPLE"
$env:AWS_SECRET_ACCESS_KEY = "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"

terraform plan

OK .Thanks Alistair.I will try it now.