Create aprovider.tf file & add the below code in it.
# Provider name
provider "aws" {
region = var.region
}
# Storing state file on S3 backend
terraform {
backend "s3" {
bucket = "tf-state-dhsoni"
region = "us-west-2"
key = "terraform.tfstate"
}
}
Note:- You need to replace the bucket value here & you need to create bucket manually on AWS. I have already created it