Amazon recommends caution when using shared AMI as they cannot vouch for the integrity of the data provided by other account holders. For more information, see the AWS documentation.
Sharing of AMI allows other AWS accounts to access the AMI without any restrictions. Sharing of only allowed if the AMI is not encrypted. This can be updated in the console, CLI, or Terraform.
In AWS Console -
In Terraform -