-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Time Rotating | ||
|
||
Terraform 中有提供一個叫做 `time_rotating` 的資源,讓你可以超過一定時間後,重新部署資源。 | ||
|
||
```hcl | ||
resource "time_rotating" "rotate_every_fifteen_seconds" { | ||
rotation_days = 15 | ||
} | ||
``` | ||
|
||
假設你想要讓 IAM Access Key 超過 15 天後就重新建立,就可以在 `lifecycle` 設定超過天數就重新建立。 | ||
|
||
```hcl | ||
resource "aws_iam_access_key" "example" { | ||
user = aws_iam_user.example.name | ||
lifecycle { | ||
replace_triggered_by = [time_rotating.rotate_every_fifteen_seconds.rotation_rfc3339] | ||
} | ||
} | ||
``` |