Great new feature in Terraform (v1.10.0 RC): ephemeral resources!
Perfect when you need to retrieve credentials that you don't want to persist in the state.
developer.hashicorp.com/terraform/la...
Currently supports aws_lambda_invocation, aws_kms_secrets, and aws_secretsmanager_secret_version