From fa331f625e3e5afe24acff5dd5ff2284077b75c3 Mon Sep 17 00:00:00 2001
From: ImpSy <3097030+ImpSy@users.noreply.github.com>
Date: Tue, 20 Jun 2023 17:02:31 +0200
Subject: [PATCH] fix removal of collect_driver_logs in provider v1.122.1
---
README.md | 10 +++++++---
main.tf | 6 +++++-
variables.tf | 13 ++++++++++++-
versions.tf | 7 ++++++-
4 files changed, 30 insertions(+), 6 deletions(-)
diff --git a/README.md b/README.md
index b4776e5..2ec3e12 100644
--- a/README.md
+++ b/README.md
@@ -168,14 +168,16 @@ terraform import module.ocean-spark.spotinst_ocean_spark.example osc-abcd1234
|------|---------|
| [terraform](#requirement\_terraform) | >= 0.13.1 |
| [kubernetes](#requirement\_kubernetes) | ~> 2.0 |
-| [spotinst](#requirement\_spotinst) | ~> 1.101 |
+| [spotinst](#requirement\_spotinst) | >= 1.115.0, < 1.123.0 |
+| [validation](#requirement\_validation) | 1.0.0 |
### Providers
| Name | Version |
|------|---------|
| [kubernetes](#provider\_kubernetes) | ~> 2.0 |
-| [spotinst](#provider\_spotinst) | ~> 1.101 |
+| [spotinst](#provider\_spotinst) | >= 1.115.0, < 1.123.0 |
+| [validation](#provider\_validation) | 1.0.0 |
### Modules
@@ -190,6 +192,7 @@ No modules.
| [kubernetes_service_account.deployer](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/service_account) | resource |
| [spotinst_ocean_spark.cluster](https://registry.terraform.io/providers/spotinst/spotinst/latest/docs/resources/ocean_spark) | resource |
| [spotinst_ocean_spark_virtual_node_group.this](https://registry.terraform.io/providers/spotinst/spotinst/latest/docs/resources/ocean_spark_virtual_node_group) | resource |
+| [validation_warning.log_collection_collect_driver_logs](https://registry.terraform.io/providers/tlkamp/validation/1.0.0/docs/data-sources/warning) | data source |
### Inputs
@@ -208,7 +211,8 @@ No modules.
| [ingress\_managed\_controller](#input\_ingress\_managed\_controller) | Controls whether an ingress controller managed by Ocean for Apache Spark will be installed on the cluster | `bool` | `true` | no |
| [ingress\_managed\_load\_balancer](#input\_ingress\_managed\_load\_balancer) | Controls whether a load balancer managed by Ocean for Apache Spark will be provisioned for the cluster | `bool` | `true` | no |
| [ingress\_private\_link\_endpoint\_service\_address](#input\_ingress\_private\_link\_endpoint\_service\_address) | The name of the VPC Endpoint Service the Ocean for Apache Spark control plane should bind to when privatelink is enabled | `string` | `null` | no |
-| [log\_collection\_collect\_driver\_logs](#input\_log\_collection\_collect\_driver\_logs) | Controls whether the Ocean Spark cluster will collect Spark driver logs | `bool` | `true` | no |
+| [log\_collection\_collect\_app\_logs](#input\_log\_collection\_collect\_app\_logs) | Controls whether the Ocean Spark cluster will collect Spark driver/executor logs | `bool` | `true` | no |
+| [log\_collection\_collect\_driver\_logs](#input\_log\_collection\_collect\_driver\_logs) | Controls whether the Ocean Spark cluster will collect Spark driver logs (Deprecated: use log\_collection\_collect\_app\_logs instead) | `bool` | `null` | no |
| [ocean\_cluster\_id](#input\_ocean\_cluster\_id) | Specifies the Ocean cluster identifier | `string` | n/a | yes |
| [spark\_additional\_app\_namespaces](#input\_spark\_additional\_app\_namespaces) | List of Kubernetes namespaces that should be configured to run Spark applications, in addition to the default 'spark-apps' namespace | `list(string)` | `[]` | no |
| [webhook\_host\_network\_ports](#input\_webhook\_host\_network\_ports) | Assign a list of ports on the host networks for our system pods | `list(number)` | `[]` | no |
diff --git a/main.tf b/main.tf
index 511e38d..efad3ca 100644
--- a/main.tf
+++ b/main.tf
@@ -41,6 +41,10 @@ resource "kubernetes_cluster_role_binding" "deployer" {
]
}
+locals {
+ collect_app_logs = coalesce(var.log_collection_collect_driver_logs, var.log_collection_collect_app_logs)
+}
+
resource "spotinst_ocean_spark" "cluster" {
ocean_cluster_id = var.ocean_cluster_id
@@ -69,7 +73,7 @@ resource "spotinst_ocean_spark" "cluster" {
}
log_collection {
- collect_driver_logs = var.log_collection_collect_driver_logs
+ collect_app_logs = local.collect_app_logs
}
webhook {
diff --git a/variables.tf b/variables.tf
index d5e3aa2..ed8ba7e 100644
--- a/variables.tf
+++ b/variables.tf
@@ -71,7 +71,18 @@ variable "ingress_private_link_endpoint_service_address" {
variable "log_collection_collect_driver_logs" {
type = bool
- description = "Controls whether the Ocean Spark cluster will collect Spark driver logs"
+ description = "Controls whether the Ocean Spark cluster will collect Spark driver logs (Deprecated: use log_collection_collect_app_logs instead)"
+ default = null
+}
+
+data "validation_warning" "log_collection_collect_driver_logs" {
+ condition = var.log_collection_collect_driver_logs != null
+ summary = "variable log_collection_collect_driver_logs is depreacted, use log_collection_collect_app_logs instead"
+}
+
+variable "log_collection_collect_app_logs" {
+ type = bool
+ description = "Controls whether the Ocean Spark cluster will collect Spark driver/executor logs"
default = true
}
diff --git a/versions.tf b/versions.tf
index b75fa66..b7c56a2 100644
--- a/versions.tf
+++ b/versions.tf
@@ -8,7 +8,12 @@ terraform {
}
spotinst = {
source = "spotinst/spotinst"
- version = "~> 1.101"
+ version = ">= 1.115.0, < 1.123.0"
+ }
+
+ validation = {
+ source = "tlkamp/validation"
+ version = "1.0.0"
}
}
}
\ No newline at end of file