Issue adding terraform state to dynamodb

Hi,

I am having an infra completely automated through terraform,initially we were keeping the state file in the local machine and later we tried to use se as remote state storage and dynamodb for state locking.

I am logging in to AWS account using assume role from another account and when I run terraform plan I am getting the below error.

=======================================


2021-08-16T18:48:52.078+0530 [DEBUG] [aws-sdk-go] {"__type":“com.amazonaws.dynamodb.v20120810#ResourceNotFoundException”,“message”:“Requested resource not found”}
2021-08-16T18:48:52.078+0530 [DEBUG] [aws-sdk-go] DEBUG: Validate Response dynamodb/GetItem failed, attempt 0/5, error ResourceNotFoundException: Requested resource not found
2021-08-16T18:48:52.079+0530 [TRACE] statemgr.Filesystem: removing lock metadata file .terraform.tfstate.lock.info
2021-08-16T18:48:52.080+0530 [TRACE] statemgr.Filesystem: unlocking terraform.tfstate using fcntl flock

│ Error: Error acquiring the state lock

│ Error message: 2 errors occurred:
│ * ResourceNotFoundException: Requested resource not found
│ * ResourceNotFoundException: Requested resource not found



│ Terraform acquires a state lock to protect the state from being written
│ by multiple users at the same time. Please resolve the issue above and try
│ again. For most commands, you can disable locking with the “-lock=false”
│ flag, but this is not recommended.

On checking google could see that these may happen if the my IAM user is not having access to dynamodb table but I verified using aws cli and I was able to write and list the contents in dynamodb.

Thanks,

How about the permission on the S3 bucket? Is this user has full permissions on S3 too? Also, are any replication operations happening on the S3 bucket?