In my case I had to use AWS CLI to configure credential This guide will help
https://medium.com/@damipetiwo/seting-up-s3-bucket-in-aws-using-terraform-5444e9b85ce6