IAM Role (arn:aws:iam::xxxxxxxxxxxx:role/demo) cannot be assumed

I have created an assume role 2 months back in a dev account and update my root user in trust relationship . Terraform was working fine with that configuration

Now I have done the same thing , but while running terraform plan , am getting this error ,

Error: operation error STS: AssumeRole, https response error StatusCode: 403, RequestID: c0e2ae10-cbaf-44b3-9ecc-16e180405088, api error AccessDenied: User: arn:aws:sts::xxxxxxxxxxxx:assumed-role/demo/aws-go-sdk-1667304405742939100 is not authorized to perform: sts:AssumeRole on resource: arn:aws:iam::xxxxxxxxxxxx:role/demo

I dont know whats the reason , the roles and trust relationship were exactly same , but may I know whats the reason for this error?

Iā€™d take a look here: Granting a user permissions to switch roles - AWS Identity and Access Management

It sounds like your user does not have the ability to assume the role (sts:AssumeRole permission). Check that the trusted relationships includes a statement like:

  "Effect": "Allow",
  "Principal": {
    "AWS": "arn:aws:sts::xxxxxxxxxxxx:assumed-role/demo/aws-go-sdk-1667304405742939100"
  "Action": "sts:AssumeRole"

aws-go-sdk-1667304405742939100 , but here , this ā€œ1667304405742939100ā€ number is keep on changing whenever I give terraform plan