'Terraform provider for AWS: refreshing token for assume_role

How can configure terraform provider for AWS to make sure it will automatically re-new session if the current session will expire?

Here https://registry.terraform.io/providers/hashicorp/aws/latest/docs I cannot find any information about refreshing mechanism and AWS says https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_use-resources.html

“You must make sure that you get a new set of credentials before the old ones expire. In some SDKs, you can use a provider that manages the process of refreshing credentials for you; check the documentation for the SDK you're using.”

I found this thread https://github.com/hashicorp/terraform/issues/5927#issuecomment-436475932 and it is explained that somehow it is already implemented but where I can find more information about how refreshing mechanism works for terraform aws?



Solution 1:[1]

Use https://registry.terraform.io/providers/hashicorp/time/latest/docs/resources/rotating

 resource "time_rotating" "example" {
   rotation_minutes = 10
 }

https://discuss.hashicorp.com/t/periodically-recreate-tls-private-key/27058

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Aleks