I created a bucket in aws S3 and given the configuration as Terraform init -backend-config=./env/prod-backend.tfvars for prod env.after initialization why the statefile is again generating in local.ideally i dont want to create a statefile in local ,instead only in S3 backend it should be.
Please let me know how to avoid creating tfstatefile in local once i create it in S3 backend
Did you specify the backend in one of your terraform files, usually main.tf
:
terraform {
backend "s3" {}
}
yes i have created terraform code for backend s3,also the tfstate is generating in S3 backend also.but i dont want in local which is by default coming
That is the way it is working, it is a local copy of the remote state.