Skip to content

Commit e3de376

Browse files
authored
feat: Support loki bucket creation (#70)
* Support loki bucket * Fix resource index * Update docs
1 parent e08002f commit e3de376

File tree

4 files changed

+47
-2
lines changed

4 files changed

+47
-2
lines changed

modules/dns-bucket/README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ A basic module used to create Cloud DNS Zone and Storage Buckets.
2828

2929
| Name | Version |
3030
|------|---------|
31-
| <a name="provider_google.source"></a> [google.source](#provider\_google.source) | n/a |
32-
| <a name="provider_google.target"></a> [google.target](#provider\_google.target) | n/a |
31+
| <a name="provider_google.source"></a> [google.source](#provider\_google.source) | 6.28.0 |
32+
| <a name="provider_google.target"></a> [google.target](#provider\_google.target) | 6.28.0 |
3333

3434
## Modules
3535

@@ -41,6 +41,7 @@ No modules.
4141
|------|------|
4242
| [google_dns_managed_zone.zone](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/dns_managed_zone) | resource |
4343
| [google_dns_record_set.delegate](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/dns_record_set) | resource |
44+
| [google_storage_bucket.loki](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/storage_bucket) | resource |
4445
| [google_storage_bucket.tiered_storage](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/storage_bucket) | resource |
4546
| [google_storage_bucket.velero](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/storage_bucket) | resource |
4647
| [google_dns_managed_zone.sn](https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/dns_managed_zone) | data source |
@@ -56,14 +57,18 @@ No modules.
5657
| <a name="input_bucket_uniform_bucket_level_access"></a> [bucket\_uniform\_bucket\_level\_access](#input\_bucket\_uniform\_bucket\_level\_access) | Enables Uniform bucket-level access access to a bucket. | `bool` | `true` | no |
5758
| <a name="input_custom_dns_zone_id"></a> [custom\_dns\_zone\_id](#input\_custom\_dns\_zone\_id) | if specified, then a streamnative zone will not be created, and this zone will be used instead. Otherwise, we will provision a new zone and delegate access | `string` | `""` | no |
5859
| <a name="input_custom_dns_zone_name"></a> [custom\_dns\_zone\_name](#input\_custom\_dns\_zone\_name) | must be passed if custom\_dns\_zone\_id is passed, this is the zone name to use | `string` | `""` | no |
60+
| <a name="input_enable_loki"></a> [enable\_loki](#input\_enable\_loki) | Enable loki storage bucket creation | `bool` | `false` | no |
5961
| <a name="input_parent_zone_name"></a> [parent\_zone\_name](#input\_parent\_zone\_name) | The parent zone in which we create the delegation records | `string` | n/a | yes |
6062
| <a name="input_pm_name"></a> [pm\_name](#input\_pm\_name) | The name of the poolmember, for new clusters, this should be like `pm-<xxxxx>` | `string` | n/a | yes |
63+
| <a name="input_pm_namespace"></a> [pm\_namespace](#input\_pm\_namespace) | The namespace of the poolmember | `string` | n/a | yes |
6164

6265
## Outputs
6366

6467
| Name | Description |
6568
|------|-------------|
6669
| <a name="output_backup_bucket"></a> [backup\_bucket](#output\_backup\_bucket) | n/a |
70+
| <a name="output_loki_bucket"></a> [loki\_bucket](#output\_loki\_bucket) | n/a |
71+
| <a name="output_tiered_storage_bucket"></a> [tiered\_storage\_bucket](#output\_tiered\_storage\_bucket) | n/a |
6772
| <a name="output_zone_id"></a> [zone\_id](#output\_zone\_id) | n/a |
6873
| <a name="output_zone_name"></a> [zone\_name](#output\_zone\_name) | n/a |
6974
<!-- END_TF_DOCS -->

modules/dns-bucket/bucket.tf

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,22 @@ resource "google_storage_bucket" "tiered_storage" {
4949
}
5050
}
5151
}
52+
53+
resource "google_storage_bucket" "loki" {
54+
count = var.enable_loki ? 1 : 0
55+
56+
name = format("loki-%s-%s", var.pm_namespace, var.pm_name)
57+
provider = google.source
58+
59+
location = var.bucket_location
60+
uniform_bucket_level_access = var.bucket_uniform_bucket_level_access
61+
force_destroy = true
62+
63+
dynamic "soft_delete_policy" {
64+
for_each = !var.bucket_cluster_backup_soft_delete ? ["apply"] : []
65+
content {
66+
retention_duration_seconds = 0
67+
}
68+
}
69+
}
70+

modules/dns-bucket/outputs.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@ output "zone_name" {
2020
value = local.zone_name
2121
}
2222

23+
24+
output "tiered_storage_bucket" {
25+
value = google_storage_bucket.tiered_storage.name
26+
}
27+
2328
output "backup_bucket" {
2429
value = google_storage_bucket.velero.name
2530
}
31+
32+
output "loki_bucket" {
33+
value = var.enable_loki ? google_storage_bucket.loki[0].name : ""
34+
}
35+

modules/dns-bucket/variables.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
variable "pm_namespace" {
16+
type = string
17+
description = "The namespace of the poolmember"
18+
}
19+
1520
variable "pm_name" {
1621
type = string
1722
description = "The name of the poolmember, for new clusters, this should be like `pm-<xxxxx>`"
@@ -62,3 +67,9 @@ variable "bucket_cluster_backup_soft_delete" {
6267
default = true
6368
description = "Set the soft deletion policy, if false soft deletes will be disabled."
6469
}
70+
71+
variable "enable_loki" {
72+
type = bool
73+
default = false
74+
description = "Enable loki storage bucket creation"
75+
}

0 commit comments

Comments
 (0)