Skip to content

Commit

Permalink
feature: add terraform note
Browse files Browse the repository at this point in the history
  • Loading branch information
yilanboy committed Sep 18, 2024
1 parent 038966e commit 8383c08
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions terraform/02-time-rotating.md
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]
}
}
```

0 comments on commit 8383c08

Please sign in to comment.