Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support OBSERVE_COLLECTION_ENDPOINT #51

Merged
merged 1 commit into from
Sep 5, 2023
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
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,9 @@ No modules.
| <a name="input_iam_name_prefix"></a> [iam\_name\_prefix](#input\_iam\_name\_prefix) | Prefix used for all created IAM roles and policies | `string` | `"observe-kinesis-firehose-"` | no |
| <a name="input_kinesis_stream"></a> [kinesis\_stream](#input\_kinesis\_stream) | Kinesis Data Stream ARN to configure as source | `object({ arn = string })` | `null` | no |
| <a name="input_name"></a> [name](#input\_name) | Name of Kinesis Firehose resource | `string` | n/a | yes |
| <a name="input_observe_customer"></a> [observe\_customer](#input\_observe\_customer) | Observe Customer ID | `string` | n/a | yes |
| <a name="input_observe_domain"></a> [observe\_domain](#input\_observe\_domain) | Observe domain | `string` | `"observeinc.com"` | no |
| <a name="input_observe_collection_endpoint"></a> [observe\_collection\_endpoint](#input\_observe\_collection\_endpoint) | Observe Collection Endpoint, e.g https://123456789012.collect.observeinc.com | `string` | `null` | no |
| <a name="input_observe_customer"></a> [observe\_customer](#input\_observe\_customer) | Observe Customer ID. Deprecated, please use observe\_collection\_endpoint instead | `string` | `null` | no |
| <a name="input_observe_domain"></a> [observe\_domain](#input\_observe\_domain) | Observe domain. Deprecated, please use observe\_collection\_endpoint instead | `string` | `"observeinc.com"` | no |
| <a name="input_observe_token"></a> [observe\_token](#input\_observe\_token) | Observe Token | `string` | n/a | yes |
| <a name="input_observe_url"></a> [observe\_url](#input\_observe\_url) | Observe URL. Deprecated. | `string` | `""` | no |
| <a name="input_s3_delivery_bucket"></a> [s3\_delivery\_bucket](#input\_s3\_delivery\_bucket) | S3 bucket to be used as backup for message delivery | <pre>object({<br> arn = string<br> })</pre> | `null` | no |
Expand Down
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ locals {
access_key = var.observe_token
create_s3_bucket = var.s3_delivery_bucket == null
s3_bucket_arn = local.create_s3_bucket ? aws_s3_bucket.bucket[0].arn : var.s3_delivery_bucket.arn
observe_url = var.observe_url != "" ? var.observe_url : format("https://%s.collect.%s/v1/kinesis", var.observe_customer, var.observe_domain)
observe_url = coalesce(var.observe_url, try("${var.observe_collection_endpoint}/v1/kinesis", ""), try("https://${var.observe_customer}.collect.${var.observe_domain}/v1/kinesis", ""), "missing")
}

resource "random_string" "bucket_suffix" {
Expand Down
15 changes: 13 additions & 2 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,20 @@ variable "name" {
type = string
}

variable "observe_collection_endpoint" {
description = "Observe Collection Endpoint, e.g https://123456789012.collect.observeinc.com"
type = string
default = null
validation {
condition = var.observe_collection_endpoint == null || can(regex("^https://.*$", var.observe_collection_endpoint))
error_message = "Endpoint must be a valid HTTPS URL."
}
}

variable "observe_customer" {
description = "Observe Customer ID"
description = "Observe Customer ID. Deprecated, please use observe_collection_endpoint instead"
type = string
default = null
}

variable "observe_token" {
Expand All @@ -19,7 +30,7 @@ variable "observe_token" {
}

variable "observe_domain" {
description = "Observe domain"
description = "Observe domain. Deprecated, please use observe_collection_endpoint instead"
type = string
nullable = false
default = "observeinc.com"
Expand Down
Loading