File tree Expand file tree Collapse file tree 7 files changed +21
-0
lines changed Expand file tree Collapse file tree 7 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ module "sdb" {
2424| ------| ---------|
2525| <a name =" requirement_terraform " ></a > [ terraform] ( #requirement_terraform ) | >= 0.13 |
2626| <a name =" requirement_scaleway " ></a > [ scaleway] ( #requirement_scaleway ) | >= 2.43.0 |
27+ | <a name =" requirement_time " ></a > [ time] ( #requirement_time ) | 0.12.0 |
2728
2829## Resources
2930
@@ -39,13 +40,15 @@ module "sdb" {
3940| [ scaleway_iam_policy.ro] ( https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/iam_policy ) | resource |
4041| [ scaleway_iam_policy.rw] ( https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/iam_policy ) | resource |
4142| [ scaleway_sdb_sql_database.main] ( https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/sdb_sql_database ) | resource |
43+ | [ time_rotating.keys_ttl] ( https://registry.terraform.io/providers/hashicorp/time/0.12.0/docs/resources/rotating ) | resource |
4244| [ scaleway_account_project.current] ( https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/data-sources/account_project ) | data source |
4345
4446## Inputs
4547
4648| Name | Description | Type | Default | Required |
4749| ------| -------------| ------| ---------| :--------:|
4850| <a name =" input_name " ></a > [ name] ( #input_name ) | Name of the database. | ` string ` | n/a | yes |
51+ | <a name =" input_keys_ttl " ></a > [ keys_ttl] ( #input_keys_ttl ) | TTL of IAM keys in days. | ` number ` | ` 0 ` | no |
4952| <a name =" input_max_cpu " ></a > [ max_cpu] ( #input_max_cpu ) | Maximum number of CPU units for your database. | ` number ` | ` 15 ` | no |
5053| <a name =" input_min_cpu " ></a > [ min_cpu] ( #input_min_cpu ) | Minimum number of CPU units for your database. | ` number ` | ` 0 ` | no |
5154| <a name =" input_region " ></a > [ region] ( #input_region ) | Region in which the resource exists. | ` string ` | ` null ` | no |
Original file line number Diff line number Diff line change @@ -19,4 +19,5 @@ resource "scaleway_iam_policy" "admin" {
1919resource "scaleway_iam_api_key" "admin" {
2020 application_id = scaleway_iam_application. admin . id
2121 default_project_id = data. scaleway_account_project . current . id
22+ expires_at = var. keys_ttl > 0 ? time_rotating. keys_ttl [0 ]. rotation_rfc3339 : null
2223}
Original file line number Diff line number Diff line change @@ -17,4 +17,5 @@ resource "scaleway_iam_policy" "ro" {
1717resource "scaleway_iam_api_key" "ro" {
1818 application_id = scaleway_iam_application. ro . id
1919 default_project_id = data. scaleway_account_project . current . id
20+ expires_at = var. keys_ttl > 0 ? time_rotating. keys_ttl [0 ]. rotation_rfc3339 : null
2021}
Original file line number Diff line number Diff line change @@ -17,4 +17,5 @@ resource "scaleway_iam_policy" "rw" {
1717resource "scaleway_iam_api_key" "rw" {
1818 application_id = scaleway_iam_application. rw . id
1919 default_project_id = data. scaleway_account_project . current . id
20+ expires_at = var. keys_ttl > 0 ? time_rotating. keys_ttl [0 ]. rotation_rfc3339 : null
2021}
Original file line number Diff line number Diff line change @@ -6,3 +6,8 @@ resource "scaleway_sdb_sql_database" "main" {
66
77 region = var. region
88}
9+
10+ resource "time_rotating" "keys_ttl" {
11+ count = var. keys_ttl > 0 ? 1 : 0
12+ rotation_days = var. keys_ttl
13+ }
Original file line number Diff line number Diff line change @@ -3,6 +3,12 @@ variable "name" {
33 type = string
44}
55
6+ variable "keys_ttl" {
7+ description = " TTL of IAM keys in days."
8+ type = number
9+ default = 0
10+ }
11+
612variable "min_cpu" {
713 description = " Minimum number of CPU units for your database."
814 type = number
Original file line number Diff line number Diff line change @@ -5,5 +5,9 @@ terraform {
55 source = " scaleway/scaleway"
66 version = " >= 2.43.0"
77 }
8+ time = {
9+ source = " hashicorp/time"
10+ version = " 0.12.0"
11+ }
812 }
913}
You can’t perform that action at this time.
0 commit comments