Terraform with github action aws MFA issue

How to work with github actions to create MFA token for aws.

Need to run this shell scipt to get the toke.


unset AWS_ACCESS_KEY_ID

unset AWS_SECRET_ACCESS_KEY

unset AWS_SESSION_TOKEN

export AWS_ACCESS_KEY_ID=<<YOUR_KEY>>

export AWS_SECRET_ACCESS_KEY=<<YOUR_SECRET>>

 

aws sts get-session-token --duration-seconds 36000 \

--serial-number arn:aws:iam::<<YOUR_IAM_ACCOUNT_NUMBER>>:mfa/<<YOUR_IAM_ACCOUNT>> \

--token-code <<YOUR_MFA_OTP>> \

--output json

 

export AWS_ACCESS_KEY_ID=<<GET_FROM_JSON>>

export AWS_SECRET_ACCESS_KEY=<<GET_FROM_JSON>>

export AWS_SESSION_TOKEN=<<GET_FROM_JSON>>


aws sts assume-role --role-arn arn:aws:iam::<<YOUR_DEV_ACCOUNT_NUMER>>:role/<<YOUR_ROLE>> \

--role-session-name <<YOUR_ROLE>> \

--duration 3600 \ --output json

 

export AWS_ACCESS_KEY_ID=<<GET_FROM_JSON>>

export AWS_SECRET_ACCESS_KEY=<<GET_FROM_JSON>>

export AWS_SESSION_TOKEN=<<GET_FROM_JSON>>```

Any help if terraform already doing this.