Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions modules/dns-bucket/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ A basic module used to create Route53 Zone and S3 Buckets.

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.76.0 |
| <a name="provider_aws.source"></a> [aws.source](#provider\_aws.source) | 5.76.0 |
| <a name="provider_aws.target"></a> [aws.target](#provider\_aws.target) | 5.76.0 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.75.0 |
| <a name="provider_aws.source"></a> [aws.source](#provider\_aws.source) | 5.75.0 |
| <a name="provider_aws.target"></a> [aws.target](#provider\_aws.target) | 5.75.0 |

## Modules

Expand All @@ -42,6 +42,7 @@ No modules.
|------|------|
| [aws_route53_record.delegate](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_record) | resource |
| [aws_route53_zone.zone](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_zone) | resource |
| [aws_s3_bucket.loki](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket) | resource |
| [aws_s3_bucket.tiered_storage](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket) | resource |
| [aws_s3_bucket.velero](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket) | resource |
| [aws_s3_bucket_server_side_encryption_configuration.velero](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_server_side_encryption_configuration) | resource |
Expand All @@ -52,11 +53,14 @@ No modules.

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_bucket_location"></a> [bucket\_location](#input\_bucket\_location) | The location of the bucket | `string` | n/a | yes |
| <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 |
| <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 |
| <a name="input_enable_loki"></a> [enable\_loki](#input\_enable\_loki) | Enable loki storage bucket creation | `bool` | `false` | no |
| <a name="input_extra_aws_tags"></a> [extra\_aws\_tags](#input\_extra\_aws\_tags) | Additional to apply to the resources. Note that this module sets the tags Name, Type, and Vendor by default. They can be overwritten, but it is not recommended. | `map(string)` | `{}` | no |
| <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 |
| <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 |
| <a name="input_pm_namespace"></a> [pm\_namespace](#input\_pm\_namespace) | The namespace of the poolmember | `string` | n/a | yes |
| <a name="input_s3_encryption_kms_key_arn"></a> [s3\_encryption\_kms\_key\_arn](#input\_s3\_encryption\_kms\_key\_arn) | KMS key ARN to use for S3 encryption. If not set, the default AWS S3 key will be used. | `string` | `""` | no |

## Outputs
Expand All @@ -65,6 +69,7 @@ No modules.
|------|-------------|
| <a name="output_backup_bucket"></a> [backup\_bucket](#output\_backup\_bucket) | n/a |
| <a name="output_backup_bucket_kms_key_id"></a> [backup\_bucket\_kms\_key\_id](#output\_backup\_bucket\_kms\_key\_id) | n/a |
| <a name="output_loki_bucket"></a> [loki\_bucket](#output\_loki\_bucket) | n/a |
| <a name="output_tiered_storage_bucket"></a> [tiered\_storage\_bucket](#output\_tiered\_storage\_bucket) | n/a |
| <a name="output_zone_id"></a> [zone\_id](#output\_zone\_id) | n/a |
| <a name="output_zone_name"></a> [zone\_name](#output\_zone\_name) | n/a |
Expand Down
20 changes: 9 additions & 11 deletions modules/dns-bucket/bucket.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,25 @@
# limitations under the License.

resource "aws_s3_bucket" "velero" {
provider = aws.target
bucket = format("%s-cluster-backup-snc", var.pm_name)
tags = merge({ "Attributes" = "backup", "Name" = "velero-backups" }, local.tags)
force_destroy = true

lifecycle {
ignore_changes = [
bucket,
]
}
}

resource "aws_s3_bucket" "tiered_storage" {
provider = aws.target
bucket = format("%s-tiered-storage-snc", var.pm_name)
tags = merge({ "Attributes" = "tiered-storage" }, local.tags)
force_destroy = true
}

lifecycle {
ignore_changes = [
bucket,
]
}
resource "aws_s3_bucket" "loki" {
count = var.enable_loki ? 1 : 0
provider = aws.source
bucket = format("loki-%s-%s", var.pm_namespace, var.pm_name)
tags = merge({ "Attributes" = "loki", "Name" = "logs-byoc" }, local.tags)
force_destroy = true
}

data "aws_kms_key" "s3_default" {
Expand Down
4 changes: 4 additions & 0 deletions modules/dns-bucket/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,8 @@ output "backup_bucket_kms_key_id" {

output "tiered_storage_bucket" {
value = aws_s3_bucket.tiered_storage.bucket
}

output "loki_bucket" {
value = var.enable_loki ? aws_s3_bucket.loki[0].bucket : ""
}
11 changes: 11 additions & 0 deletions modules/dns-bucket/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.

variable "pm_namespace" {
type = string
description = "The namespace of the poolmember"
}

variable "pm_name" {
description = "The name of the poolmember, for new clusters, this should be like `pm-<xxxxx>`"
type = string
Expand Down Expand Up @@ -51,3 +56,9 @@ locals {
"Vendor" = "StreamNative"
}, var.extra_aws_tags)
}

variable "enable_loki" {
type = bool
default = false
description = "Enable loki storage bucket creation"
}
Loading