diff --git a/deploy/helm/sumologic/conf/cleanup/cleanup.sh b/deploy/helm/sumologic/conf/cleanup/cleanup.sh index 3e2434db0..9d88d45ef 100755 --- a/deploy/helm/sumologic/conf/cleanup/cleanup.sh +++ b/deploy/helm/sumologic/conf/cleanup/cleanup.sh @@ -10,6 +10,8 @@ export HTTPS_PROXY="${HTTPS_PROXY:=""}" export NO_PROXY="${NO_PROXY:=""}" readonly SUMOLOGIC_COLLECTOR_NAME="${SUMOLOGIC_COLLECTOR_NAME:?}" +readonly SUMOLOGIC_SECRET_NAME="${SUMOLOGIC_SECRET_NAME:?}" +readonly NAMESPACE="${NAMESPACE:?}" # Set variables for terraform export TF_VAR_collector_name="${SUMOLOGIC_COLLECTOR_NAME}" @@ -26,7 +28,7 @@ terraform init -input=false -get=false || terraform init -input=false -upgrade # shellcheck disable=SC1083 terraform import sumologic_collector.collector "${SUMOLOGIC_COLLECTOR_NAME}" # shellcheck disable=SC1083 -terraform import kubernetes_secret.sumologic_collection_secret {{ template "terraform.secret.fullname" . }} +terraform import kubernetes_secret.sumologic_collection_secret "${NAMESPACE}/${SUMOLOGIC_SECRET_NAME}" terraform destroy -auto-approve diff --git a/deploy/helm/sumologic/conf/setup/resources.tf b/deploy/helm/sumologic/conf/setup/resources.tf index bbae01df0..6fb7e790b 100644 --- a/deploy/helm/sumologic/conf/setup/resources.tf +++ b/deploy/helm/sumologic/conf/setup/resources.tf @@ -6,7 +6,7 @@ resource "sumologic_collector" "collector" { resource "kubernetes_secret" "sumologic_collection_secret" { metadata { - name = "{{ template "terraform.secret.name" }}" + name = var.secret_name namespace = var.namespace_name } diff --git a/deploy/helm/sumologic/conf/setup/setup.sh b/deploy/helm/sumologic/conf/setup/setup.sh index ad22889ba..a3eeb4685 100755 --- a/deploy/helm/sumologic/conf/setup/setup.sh +++ b/deploy/helm/sumologic/conf/setup/setup.sh @@ -3,11 +3,14 @@ readonly DEBUG_MODE=${DEBUG_MODE:="false"} readonly DEBUG_MODE_ENABLED_FLAG="true" readonly SUMOLOGIC_COLLECTOR_NAME="${SUMOLOGIC_COLLECTOR_NAME:?}" +readonly NAMESPACE="${NAMESPACE:?}" +readonly SUMOLOGIC_SECRET_NAME="${SUMOLOGIC_SECRET_NAME:?}" # Set variables for terraform export TF_VAR_collector_name="${SUMOLOGIC_COLLECTOR_NAME}" +export TF_VAR_namespace_name="${NAMESPACE}" +export TF_VAR_secret_name="${SUMOLOGIC_SECRET_NAME}" export TF_VAR_chart_version="${CHART_VERSION:?}" -export TF_VAR_namespace_name="${NAMESPACE:?}" # Let's compare the variables ignoring the case with help of ${VARIABLE,,} which makes the string lowercased # so that we don't have to deal with True vs true vs TRUE @@ -149,7 +152,7 @@ terraform import sumologic_http_source.{{ template "terraform.sources.name" (dic fi # Kubernetes Secret -terraform import kubernetes_secret.sumologic_collection_secret {{ template "terraform.secret.fullname" . }} +terraform import kubernetes_secret.sumologic_collection_secret "${NAMESPACE}/${SUMOLOGIC_SECRET_NAME}" # Apply planned changes TF_LOG_PROVIDER=DEBUG terraform apply \ diff --git a/deploy/helm/sumologic/conf/setup/variables.tf b/deploy/helm/sumologic/conf/setup/variables.tf index 3b9497c1d..d0d048512 100644 --- a/deploy/helm/sumologic/conf/setup/variables.tf +++ b/deploy/helm/sumologic/conf/setup/variables.tf @@ -6,6 +6,10 @@ variable "namespace_name" { type = string } +variable "secret_name" { + type = string +} + variable "create_fields" { description = "If set, Terraform will attempt to create fields at Sumo Logic" type = bool diff --git a/deploy/helm/sumologic/templates/_helpers/_setup.tpl b/deploy/helm/sumologic/templates/_helpers/_setup.tpl index b676d3d12..f0e4ee1da 100644 --- a/deploy/helm/sumologic/templates/_helpers/_setup.tpl +++ b/deploy/helm/sumologic/templates/_helpers/_setup.tpl @@ -10,18 +10,6 @@ Example usage: {{ printf "%s" "sumologic" }} {{- end -}} -{{/* -Returns the name of Kubernetes secret prefixed with release namespace. - -Example usage: - -{{ include "terraform.secret.fullname" }} - -*/}} -{{- define "terraform.secret.fullname" -}} -{{ template "sumologic.namespace" . }}/{{ template "terraform.secret.name" . }} -{{- end -}} - {{/* Convert source name to Terraform metric name: * converts all `-` to `_` diff --git a/deploy/helm/sumologic/templates/cleanup/job.yaml b/deploy/helm/sumologic/templates/cleanup/job.yaml index 05ad87757..d4168d21f 100644 --- a/deploy/helm/sumologic/templates/cleanup/job.yaml +++ b/deploy/helm/sumologic/templates/cleanup/job.yaml @@ -66,6 +66,8 @@ spec: value: {{ include "terraform.collector.name" . }} - name: CHART_VERSION value: "{{ .Chart.Version }}" + - name: SUMOLOGIC_SECRET_NAME + value: "{{ template "terraform.secret.name" }}" {{- include "proxy-env-variables" . | nindent 10 }} securityContext: runAsUser: 999 diff --git a/deploy/helm/sumologic/templates/setup/job.yaml b/deploy/helm/sumologic/templates/setup/job.yaml index 6ff8cbdc6..ef87e46b3 100644 --- a/deploy/helm/sumologic/templates/setup/job.yaml +++ b/deploy/helm/sumologic/templates/setup/job.yaml @@ -79,6 +79,8 @@ spec: {{- end }} - name: SUMOLOGIC_COLLECTOR_NAME value: {{ include "terraform.collector.name" . }} + - name: SUMOLOGIC_SECRET_NAME + value: "{{ template "terraform.secret.name" }}" - name: CHART_VERSION value: "{{ .Chart.Version }}" {{- include "proxy-env-variables" . | nindent 8 -}} diff --git a/tests/helm/testdata/goldenfile/cleanup/basic.output.yaml b/tests/helm/testdata/goldenfile/cleanup/basic.output.yaml index 447da37ae..1b9c41e4e 100644 --- a/tests/helm/testdata/goldenfile/cleanup/basic.output.yaml +++ b/tests/helm/testdata/goldenfile/cleanup/basic.output.yaml @@ -61,6 +61,8 @@ spec: value: kubernetes - name: CHART_VERSION value: "%CURRENT_CHART_VERSION%" + - name: SUMOLOGIC_SECRET_NAME + value: "sumologic" - name: NO_PROXY value: kubernetes.default.svc diff --git a/tests/helm/testdata/goldenfile/cleanup/sumologic-mock-no-secret.output.yaml b/tests/helm/testdata/goldenfile/cleanup/sumologic-mock-no-secret.output.yaml index 874635f7f..d7efd0bc8 100644 --- a/tests/helm/testdata/goldenfile/cleanup/sumologic-mock-no-secret.output.yaml +++ b/tests/helm/testdata/goldenfile/cleanup/sumologic-mock-no-secret.output.yaml @@ -61,6 +61,8 @@ spec: value: kubernetes - name: CHART_VERSION value: "%CURRENT_CHART_VERSION%" + - name: SUMOLOGIC_SECRET_NAME + value: "sumologic" - name: NO_PROXY value: kubernetes.default.svc diff --git a/tests/helm/testdata/goldenfile/cleanup/sumologic-mock.output.yaml b/tests/helm/testdata/goldenfile/cleanup/sumologic-mock.output.yaml index 79a8c4f98..f04419b47 100644 --- a/tests/helm/testdata/goldenfile/cleanup/sumologic-mock.output.yaml +++ b/tests/helm/testdata/goldenfile/cleanup/sumologic-mock.output.yaml @@ -61,6 +61,8 @@ spec: value: kubernetes - name: CHART_VERSION value: "%CURRENT_CHART_VERSION%" + - name: SUMOLOGIC_SECRET_NAME + value: "sumologic" - name: NO_PROXY value: kubernetes.default.svc diff --git a/tests/helm/testdata/goldenfile/setup/basic.output.yaml b/tests/helm/testdata/goldenfile/setup/basic.output.yaml index aec6c0de3..67067c6f5 100644 --- a/tests/helm/testdata/goldenfile/setup/basic.output.yaml +++ b/tests/helm/testdata/goldenfile/setup/basic.output.yaml @@ -63,6 +63,8 @@ spec: value: - name: SUMOLOGIC_COLLECTOR_NAME value: kubernetes + - name: SUMOLOGIC_SECRET_NAME + value: "sumologic" - name: CHART_VERSION value: "%CURRENT_CHART_VERSION%" diff --git a/tests/helm/testdata/goldenfile/setup/sumologic-mock-no-secret.output.yaml b/tests/helm/testdata/goldenfile/setup/sumologic-mock-no-secret.output.yaml index a64161bee..ae2f28ac3 100644 --- a/tests/helm/testdata/goldenfile/setup/sumologic-mock-no-secret.output.yaml +++ b/tests/helm/testdata/goldenfile/setup/sumologic-mock-no-secret.output.yaml @@ -63,6 +63,8 @@ spec: value: http://RELEASE-NAME-sumologic-mock.sumologic.svc.cluster.local.:3000/terraform/api/ - name: SUMOLOGIC_COLLECTOR_NAME value: kubernetes + - name: SUMOLOGIC_SECRET_NAME + value: "sumologic" - name: CHART_VERSION value: "%CURRENT_CHART_VERSION%" diff --git a/tests/helm/testdata/goldenfile/setup/sumologic-mock.output.yaml b/tests/helm/testdata/goldenfile/setup/sumologic-mock.output.yaml index a64161bee..ae2f28ac3 100644 --- a/tests/helm/testdata/goldenfile/setup/sumologic-mock.output.yaml +++ b/tests/helm/testdata/goldenfile/setup/sumologic-mock.output.yaml @@ -63,6 +63,8 @@ spec: value: http://RELEASE-NAME-sumologic-mock.sumologic.svc.cluster.local.:3000/terraform/api/ - name: SUMOLOGIC_COLLECTOR_NAME value: kubernetes + - name: SUMOLOGIC_SECRET_NAME + value: "sumologic" - name: CHART_VERSION value: "%CURRENT_CHART_VERSION%" diff --git a/tests/helm/testdata/goldenfile/terraform/all_fields.output.yaml b/tests/helm/testdata/goldenfile/terraform/all_fields.output.yaml index 02846d5e7..7954d7615 100644 --- a/tests/helm/testdata/goldenfile/terraform/all_fields.output.yaml +++ b/tests/helm/testdata/goldenfile/terraform/all_fields.output.yaml @@ -338,7 +338,7 @@ data: resource "kubernetes_secret" "sumologic_collection_secret" { metadata { - name = "sumologic" + name = var.secret_name namespace = var.namespace_name } @@ -354,11 +354,14 @@ data: readonly DEBUG_MODE=${DEBUG_MODE:="false"} readonly DEBUG_MODE_ENABLED_FLAG="true" readonly SUMOLOGIC_COLLECTOR_NAME="${SUMOLOGIC_COLLECTOR_NAME:?}" + readonly NAMESPACE="${NAMESPACE:?}" + readonly SUMOLOGIC_SECRET_NAME="${SUMOLOGIC_SECRET_NAME:?}" # Set variables for terraform export TF_VAR_collector_name="${SUMOLOGIC_COLLECTOR_NAME}" + export TF_VAR_namespace_name="${NAMESPACE}" + export TF_VAR_secret_name="${SUMOLOGIC_SECRET_NAME}" export TF_VAR_chart_version="${CHART_VERSION:?}" - export TF_VAR_namespace_name="${NAMESPACE:?}" # Let's compare the variables ignoring the case with help of ${VARIABLE,,} which makes the string lowercased # so that we don't have to deal with True vs true vs TRUE @@ -499,7 +502,7 @@ data: fi # Kubernetes Secret - terraform import kubernetes_secret.sumologic_collection_secret sumologic/sumologic + terraform import kubernetes_secret.sumologic_collection_secret "${NAMESPACE}/${SUMOLOGIC_SECRET_NAME}" # Apply planned changes TF_LOG_PROVIDER=DEBUG terraform apply \ @@ -839,6 +842,10 @@ data: type = string } + variable "secret_name" { + type = string + } + variable "create_fields" { description = "If set, Terraform will attempt to create fields at Sumo Logic" type = bool diff --git a/tests/helm/testdata/goldenfile/terraform/collector_fields.output.yaml b/tests/helm/testdata/goldenfile/terraform/collector_fields.output.yaml index ff4acdb83..b57792f82 100644 --- a/tests/helm/testdata/goldenfile/terraform/collector_fields.output.yaml +++ b/tests/helm/testdata/goldenfile/terraform/collector_fields.output.yaml @@ -338,7 +338,7 @@ data: resource "kubernetes_secret" "sumologic_collection_secret" { metadata { - name = "sumologic" + name = var.secret_name namespace = var.namespace_name } @@ -354,11 +354,14 @@ data: readonly DEBUG_MODE=${DEBUG_MODE:="false"} readonly DEBUG_MODE_ENABLED_FLAG="true" readonly SUMOLOGIC_COLLECTOR_NAME="${SUMOLOGIC_COLLECTOR_NAME:?}" + readonly NAMESPACE="${NAMESPACE:?}" + readonly SUMOLOGIC_SECRET_NAME="${SUMOLOGIC_SECRET_NAME:?}" # Set variables for terraform export TF_VAR_collector_name="${SUMOLOGIC_COLLECTOR_NAME}" + export TF_VAR_namespace_name="${NAMESPACE}" + export TF_VAR_secret_name="${SUMOLOGIC_SECRET_NAME}" export TF_VAR_chart_version="${CHART_VERSION:?}" - export TF_VAR_namespace_name="${NAMESPACE:?}" # Let's compare the variables ignoring the case with help of ${VARIABLE,,} which makes the string lowercased # so that we don't have to deal with True vs true vs TRUE @@ -498,7 +501,7 @@ data: fi # Kubernetes Secret - terraform import kubernetes_secret.sumologic_collection_secret sumologic/sumologic + terraform import kubernetes_secret.sumologic_collection_secret "${NAMESPACE}/${SUMOLOGIC_SECRET_NAME}" # Apply planned changes TF_LOG_PROVIDER=DEBUG terraform apply \ @@ -742,6 +745,10 @@ data: type = string } + variable "secret_name" { + type = string + } + variable "create_fields" { description = "If set, Terraform will attempt to create fields at Sumo Logic" type = bool diff --git a/tests/helm/testdata/goldenfile/terraform/conditional_sources.output.yaml b/tests/helm/testdata/goldenfile/terraform/conditional_sources.output.yaml index d02a9e42a..9b96591ee 100644 --- a/tests/helm/testdata/goldenfile/terraform/conditional_sources.output.yaml +++ b/tests/helm/testdata/goldenfile/terraform/conditional_sources.output.yaml @@ -338,7 +338,7 @@ data: resource "kubernetes_secret" "sumologic_collection_secret" { metadata { - name = "sumologic" + name = var.secret_name namespace = var.namespace_name } @@ -354,11 +354,14 @@ data: readonly DEBUG_MODE=${DEBUG_MODE:="false"} readonly DEBUG_MODE_ENABLED_FLAG="true" readonly SUMOLOGIC_COLLECTOR_NAME="${SUMOLOGIC_COLLECTOR_NAME:?}" + readonly NAMESPACE="${NAMESPACE:?}" + readonly SUMOLOGIC_SECRET_NAME="${SUMOLOGIC_SECRET_NAME:?}" # Set variables for terraform export TF_VAR_collector_name="${SUMOLOGIC_COLLECTOR_NAME}" + export TF_VAR_namespace_name="${NAMESPACE}" + export TF_VAR_secret_name="${SUMOLOGIC_SECRET_NAME}" export TF_VAR_chart_version="${CHART_VERSION:?}" - export TF_VAR_namespace_name="${NAMESPACE:?}" # Let's compare the variables ignoring the case with help of ${VARIABLE,,} which makes the string lowercased # so that we don't have to deal with True vs true vs TRUE @@ -483,7 +486,7 @@ data: fi # Kubernetes Secret - terraform import kubernetes_secret.sumologic_collection_secret sumologic/sumologic + terraform import kubernetes_secret.sumologic_collection_secret "${NAMESPACE}/${SUMOLOGIC_SECRET_NAME}" # Apply planned changes TF_LOG_PROVIDER=DEBUG terraform apply \ @@ -538,6 +541,10 @@ data: type = string } + variable "secret_name" { + type = string + } + variable "create_fields" { description = "If set, Terraform will attempt to create fields at Sumo Logic" type = bool diff --git a/tests/helm/testdata/goldenfile/terraform/custom.output.yaml b/tests/helm/testdata/goldenfile/terraform/custom.output.yaml index d02a9e42a..9b96591ee 100644 --- a/tests/helm/testdata/goldenfile/terraform/custom.output.yaml +++ b/tests/helm/testdata/goldenfile/terraform/custom.output.yaml @@ -338,7 +338,7 @@ data: resource "kubernetes_secret" "sumologic_collection_secret" { metadata { - name = "sumologic" + name = var.secret_name namespace = var.namespace_name } @@ -354,11 +354,14 @@ data: readonly DEBUG_MODE=${DEBUG_MODE:="false"} readonly DEBUG_MODE_ENABLED_FLAG="true" readonly SUMOLOGIC_COLLECTOR_NAME="${SUMOLOGIC_COLLECTOR_NAME:?}" + readonly NAMESPACE="${NAMESPACE:?}" + readonly SUMOLOGIC_SECRET_NAME="${SUMOLOGIC_SECRET_NAME:?}" # Set variables for terraform export TF_VAR_collector_name="${SUMOLOGIC_COLLECTOR_NAME}" + export TF_VAR_namespace_name="${NAMESPACE}" + export TF_VAR_secret_name="${SUMOLOGIC_SECRET_NAME}" export TF_VAR_chart_version="${CHART_VERSION:?}" - export TF_VAR_namespace_name="${NAMESPACE:?}" # Let's compare the variables ignoring the case with help of ${VARIABLE,,} which makes the string lowercased # so that we don't have to deal with True vs true vs TRUE @@ -483,7 +486,7 @@ data: fi # Kubernetes Secret - terraform import kubernetes_secret.sumologic_collection_secret sumologic/sumologic + terraform import kubernetes_secret.sumologic_collection_secret "${NAMESPACE}/${SUMOLOGIC_SECRET_NAME}" # Apply planned changes TF_LOG_PROVIDER=DEBUG terraform apply \ @@ -538,6 +541,10 @@ data: type = string } + variable "secret_name" { + type = string + } + variable "create_fields" { description = "If set, Terraform will attempt to create fields at Sumo Logic" type = bool diff --git a/tests/helm/testdata/goldenfile/terraform/default.output.yaml b/tests/helm/testdata/goldenfile/terraform/default.output.yaml index 0215f1219..de0e7d0f6 100644 --- a/tests/helm/testdata/goldenfile/terraform/default.output.yaml +++ b/tests/helm/testdata/goldenfile/terraform/default.output.yaml @@ -338,7 +338,7 @@ data: resource "kubernetes_secret" "sumologic_collection_secret" { metadata { - name = "sumologic" + name = var.secret_name namespace = var.namespace_name } @@ -354,11 +354,14 @@ data: readonly DEBUG_MODE=${DEBUG_MODE:="false"} readonly DEBUG_MODE_ENABLED_FLAG="true" readonly SUMOLOGIC_COLLECTOR_NAME="${SUMOLOGIC_COLLECTOR_NAME:?}" + readonly NAMESPACE="${NAMESPACE:?}" + readonly SUMOLOGIC_SECRET_NAME="${SUMOLOGIC_SECRET_NAME:?}" # Set variables for terraform export TF_VAR_collector_name="${SUMOLOGIC_COLLECTOR_NAME}" + export TF_VAR_namespace_name="${NAMESPACE}" + export TF_VAR_secret_name="${SUMOLOGIC_SECRET_NAME}" export TF_VAR_chart_version="${CHART_VERSION:?}" - export TF_VAR_namespace_name="${NAMESPACE:?}" # Let's compare the variables ignoring the case with help of ${VARIABLE,,} which makes the string lowercased # so that we don't have to deal with True vs true vs TRUE @@ -498,7 +501,7 @@ data: fi # Kubernetes Secret - terraform import kubernetes_secret.sumologic_collection_secret sumologic/sumologic + terraform import kubernetes_secret.sumologic_collection_secret "${NAMESPACE}/${SUMOLOGIC_SECRET_NAME}" # Apply planned changes TF_LOG_PROVIDER=DEBUG terraform apply \ @@ -739,6 +742,10 @@ data: type = string } + variable "secret_name" { + type = string + } + variable "create_fields" { description = "If set, Terraform will attempt to create fields at Sumo Logic" type = bool diff --git a/tests/helm/testdata/goldenfile/terraform/disable_default_metrics.output.yaml b/tests/helm/testdata/goldenfile/terraform/disable_default_metrics.output.yaml index cefc7ae2a..4259207f9 100644 --- a/tests/helm/testdata/goldenfile/terraform/disable_default_metrics.output.yaml +++ b/tests/helm/testdata/goldenfile/terraform/disable_default_metrics.output.yaml @@ -338,7 +338,7 @@ data: resource "kubernetes_secret" "sumologic_collection_secret" { metadata { - name = "sumologic" + name = var.secret_name namespace = var.namespace_name } @@ -354,11 +354,14 @@ data: readonly DEBUG_MODE=${DEBUG_MODE:="false"} readonly DEBUG_MODE_ENABLED_FLAG="true" readonly SUMOLOGIC_COLLECTOR_NAME="${SUMOLOGIC_COLLECTOR_NAME:?}" + readonly NAMESPACE="${NAMESPACE:?}" + readonly SUMOLOGIC_SECRET_NAME="${SUMOLOGIC_SECRET_NAME:?}" # Set variables for terraform export TF_VAR_collector_name="${SUMOLOGIC_COLLECTOR_NAME}" + export TF_VAR_namespace_name="${NAMESPACE}" + export TF_VAR_secret_name="${SUMOLOGIC_SECRET_NAME}" export TF_VAR_chart_version="${CHART_VERSION:?}" - export TF_VAR_namespace_name="${NAMESPACE:?}" # Let's compare the variables ignoring the case with help of ${VARIABLE,,} which makes the string lowercased # so that we don't have to deal with True vs true vs TRUE @@ -497,7 +500,7 @@ data: fi # Kubernetes Secret - terraform import kubernetes_secret.sumologic_collection_secret sumologic/sumologic + terraform import kubernetes_secret.sumologic_collection_secret "${NAMESPACE}/${SUMOLOGIC_SECRET_NAME}" # Apply planned changes TF_LOG_PROVIDER=DEBUG terraform apply \ @@ -729,6 +732,10 @@ data: type = string } + variable "secret_name" { + type = string + } + variable "create_fields" { description = "If set, Terraform will attempt to create fields at Sumo Logic" type = bool diff --git a/tests/helm/testdata/goldenfile/terraform/disabled_dashboards.output.yaml b/tests/helm/testdata/goldenfile/terraform/disabled_dashboards.output.yaml index c1fdc4afb..513e4037a 100644 --- a/tests/helm/testdata/goldenfile/terraform/disabled_dashboards.output.yaml +++ b/tests/helm/testdata/goldenfile/terraform/disabled_dashboards.output.yaml @@ -338,7 +338,7 @@ data: resource "kubernetes_secret" "sumologic_collection_secret" { metadata { - name = "sumologic" + name = var.secret_name namespace = var.namespace_name } @@ -354,11 +354,14 @@ data: readonly DEBUG_MODE=${DEBUG_MODE:="false"} readonly DEBUG_MODE_ENABLED_FLAG="true" readonly SUMOLOGIC_COLLECTOR_NAME="${SUMOLOGIC_COLLECTOR_NAME:?}" + readonly NAMESPACE="${NAMESPACE:?}" + readonly SUMOLOGIC_SECRET_NAME="${SUMOLOGIC_SECRET_NAME:?}" # Set variables for terraform export TF_VAR_collector_name="${SUMOLOGIC_COLLECTOR_NAME}" + export TF_VAR_namespace_name="${NAMESPACE}" + export TF_VAR_secret_name="${SUMOLOGIC_SECRET_NAME}" export TF_VAR_chart_version="${CHART_VERSION:?}" - export TF_VAR_namespace_name="${NAMESPACE:?}" # Let's compare the variables ignoring the case with help of ${VARIABLE,,} which makes the string lowercased # so that we don't have to deal with True vs true vs TRUE @@ -498,7 +501,7 @@ data: fi # Kubernetes Secret - terraform import kubernetes_secret.sumologic_collection_secret sumologic/sumologic + terraform import kubernetes_secret.sumologic_collection_secret "${NAMESPACE}/${SUMOLOGIC_SECRET_NAME}" # Apply planned changes TF_LOG_PROVIDER=DEBUG terraform apply \ @@ -741,6 +744,10 @@ data: type = string } + variable "secret_name" { + type = string + } + variable "create_fields" { description = "If set, Terraform will attempt to create fields at Sumo Logic" type = bool diff --git a/tests/helm/testdata/goldenfile/terraform/disabled_monitors.output.yaml b/tests/helm/testdata/goldenfile/terraform/disabled_monitors.output.yaml index ceebbadf6..957afcf69 100644 --- a/tests/helm/testdata/goldenfile/terraform/disabled_monitors.output.yaml +++ b/tests/helm/testdata/goldenfile/terraform/disabled_monitors.output.yaml @@ -338,7 +338,7 @@ data: resource "kubernetes_secret" "sumologic_collection_secret" { metadata { - name = "sumologic" + name = var.secret_name namespace = var.namespace_name } @@ -354,11 +354,14 @@ data: readonly DEBUG_MODE=${DEBUG_MODE:="false"} readonly DEBUG_MODE_ENABLED_FLAG="true" readonly SUMOLOGIC_COLLECTOR_NAME="${SUMOLOGIC_COLLECTOR_NAME:?}" + readonly NAMESPACE="${NAMESPACE:?}" + readonly SUMOLOGIC_SECRET_NAME="${SUMOLOGIC_SECRET_NAME:?}" # Set variables for terraform export TF_VAR_collector_name="${SUMOLOGIC_COLLECTOR_NAME}" + export TF_VAR_namespace_name="${NAMESPACE}" + export TF_VAR_secret_name="${SUMOLOGIC_SECRET_NAME}" export TF_VAR_chart_version="${CHART_VERSION:?}" - export TF_VAR_namespace_name="${NAMESPACE:?}" # Let's compare the variables ignoring the case with help of ${VARIABLE,,} which makes the string lowercased # so that we don't have to deal with True vs true vs TRUE @@ -498,7 +501,7 @@ data: fi # Kubernetes Secret - terraform import kubernetes_secret.sumologic_collection_secret sumologic/sumologic + terraform import kubernetes_secret.sumologic_collection_secret "${NAMESPACE}/${SUMOLOGIC_SECRET_NAME}" # Apply planned changes TF_LOG_PROVIDER=DEBUG terraform apply \ @@ -741,6 +744,10 @@ data: type = string } + variable "secret_name" { + type = string + } + variable "create_fields" { description = "If set, Terraform will attempt to create fields at Sumo Logic" type = bool diff --git a/tests/helm/testdata/goldenfile/terraform/logs_fields.output.yaml b/tests/helm/testdata/goldenfile/terraform/logs_fields.output.yaml index c4beed39a..d4a4a39ea 100644 --- a/tests/helm/testdata/goldenfile/terraform/logs_fields.output.yaml +++ b/tests/helm/testdata/goldenfile/terraform/logs_fields.output.yaml @@ -338,7 +338,7 @@ data: resource "kubernetes_secret" "sumologic_collection_secret" { metadata { - name = "sumologic" + name = var.secret_name namespace = var.namespace_name } @@ -354,11 +354,14 @@ data: readonly DEBUG_MODE=${DEBUG_MODE:="false"} readonly DEBUG_MODE_ENABLED_FLAG="true" readonly SUMOLOGIC_COLLECTOR_NAME="${SUMOLOGIC_COLLECTOR_NAME:?}" + readonly NAMESPACE="${NAMESPACE:?}" + readonly SUMOLOGIC_SECRET_NAME="${SUMOLOGIC_SECRET_NAME:?}" # Set variables for terraform export TF_VAR_collector_name="${SUMOLOGIC_COLLECTOR_NAME}" + export TF_VAR_namespace_name="${NAMESPACE}" + export TF_VAR_secret_name="${SUMOLOGIC_SECRET_NAME}" export TF_VAR_chart_version="${CHART_VERSION:?}" - export TF_VAR_namespace_name="${NAMESPACE:?}" # Let's compare the variables ignoring the case with help of ${VARIABLE,,} which makes the string lowercased # so that we don't have to deal with True vs true vs TRUE @@ -498,7 +501,7 @@ data: fi # Kubernetes Secret - terraform import kubernetes_secret.sumologic_collection_secret sumologic/sumologic + terraform import kubernetes_secret.sumologic_collection_secret "${NAMESPACE}/${SUMOLOGIC_SECRET_NAME}" # Apply planned changes TF_LOG_PROVIDER=DEBUG terraform apply \ @@ -741,6 +744,10 @@ data: type = string } + variable "secret_name" { + type = string + } + variable "create_fields" { description = "If set, Terraform will attempt to create fields at Sumo Logic" type = bool diff --git a/tests/helm/testdata/goldenfile/terraform/monitors_with_email_notifications.output.yaml b/tests/helm/testdata/goldenfile/terraform/monitors_with_email_notifications.output.yaml index 7249d2b22..148a51c2c 100644 --- a/tests/helm/testdata/goldenfile/terraform/monitors_with_email_notifications.output.yaml +++ b/tests/helm/testdata/goldenfile/terraform/monitors_with_email_notifications.output.yaml @@ -344,7 +344,7 @@ data: resource "kubernetes_secret" "sumologic_collection_secret" { metadata { - name = "sumologic" + name = var.secret_name namespace = var.namespace_name } @@ -360,11 +360,14 @@ data: readonly DEBUG_MODE=${DEBUG_MODE:="false"} readonly DEBUG_MODE_ENABLED_FLAG="true" readonly SUMOLOGIC_COLLECTOR_NAME="${SUMOLOGIC_COLLECTOR_NAME:?}" + readonly NAMESPACE="${NAMESPACE:?}" + readonly SUMOLOGIC_SECRET_NAME="${SUMOLOGIC_SECRET_NAME:?}" # Set variables for terraform export TF_VAR_collector_name="${SUMOLOGIC_COLLECTOR_NAME}" + export TF_VAR_namespace_name="${NAMESPACE}" + export TF_VAR_secret_name="${SUMOLOGIC_SECRET_NAME}" export TF_VAR_chart_version="${CHART_VERSION:?}" - export TF_VAR_namespace_name="${NAMESPACE:?}" # Let's compare the variables ignoring the case with help of ${VARIABLE,,} which makes the string lowercased # so that we don't have to deal with True vs true vs TRUE @@ -504,7 +507,7 @@ data: fi # Kubernetes Secret - terraform import kubernetes_secret.sumologic_collection_secret sumologic/sumologic + terraform import kubernetes_secret.sumologic_collection_secret "${NAMESPACE}/${SUMOLOGIC_SECRET_NAME}" # Apply planned changes TF_LOG_PROVIDER=DEBUG terraform apply \ @@ -745,6 +748,10 @@ data: type = string } + variable "secret_name" { + type = string + } + variable "create_fields" { description = "If set, Terraform will attempt to create fields at Sumo Logic" type = bool diff --git a/tests/helm/testdata/goldenfile/terraform/monitors_with_single_email.output.yaml b/tests/helm/testdata/goldenfile/terraform/monitors_with_single_email.output.yaml index b03cafda6..d1018ec4e 100644 --- a/tests/helm/testdata/goldenfile/terraform/monitors_with_single_email.output.yaml +++ b/tests/helm/testdata/goldenfile/terraform/monitors_with_single_email.output.yaml @@ -344,7 +344,7 @@ data: resource "kubernetes_secret" "sumologic_collection_secret" { metadata { - name = "sumologic" + name = var.secret_name namespace = var.namespace_name } @@ -360,11 +360,14 @@ data: readonly DEBUG_MODE=${DEBUG_MODE:="false"} readonly DEBUG_MODE_ENABLED_FLAG="true" readonly SUMOLOGIC_COLLECTOR_NAME="${SUMOLOGIC_COLLECTOR_NAME:?}" + readonly NAMESPACE="${NAMESPACE:?}" + readonly SUMOLOGIC_SECRET_NAME="${SUMOLOGIC_SECRET_NAME:?}" # Set variables for terraform export TF_VAR_collector_name="${SUMOLOGIC_COLLECTOR_NAME}" + export TF_VAR_namespace_name="${NAMESPACE}" + export TF_VAR_secret_name="${SUMOLOGIC_SECRET_NAME}" export TF_VAR_chart_version="${CHART_VERSION:?}" - export TF_VAR_namespace_name="${NAMESPACE:?}" # Let's compare the variables ignoring the case with help of ${VARIABLE,,} which makes the string lowercased # so that we don't have to deal with True vs true vs TRUE @@ -504,7 +507,7 @@ data: fi # Kubernetes Secret - terraform import kubernetes_secret.sumologic_collection_secret sumologic/sumologic + terraform import kubernetes_secret.sumologic_collection_secret "${NAMESPACE}/${SUMOLOGIC_SECRET_NAME}" # Apply planned changes TF_LOG_PROVIDER=DEBUG terraform apply \ @@ -745,6 +748,10 @@ data: type = string } + variable "secret_name" { + type = string + } + variable "create_fields" { description = "If set, Terraform will attempt to create fields at Sumo Logic" type = bool diff --git a/tests/helm/testdata/goldenfile/terraform/strip_extrapolation.output.yaml b/tests/helm/testdata/goldenfile/terraform/strip_extrapolation.output.yaml index d497973f5..e5fa04e9d 100644 --- a/tests/helm/testdata/goldenfile/terraform/strip_extrapolation.output.yaml +++ b/tests/helm/testdata/goldenfile/terraform/strip_extrapolation.output.yaml @@ -339,7 +339,7 @@ data: resource "kubernetes_secret" "sumologic_collection_secret" { metadata { - name = "sumologic" + name = var.secret_name namespace = var.namespace_name } @@ -355,11 +355,14 @@ data: readonly DEBUG_MODE=${DEBUG_MODE:="false"} readonly DEBUG_MODE_ENABLED_FLAG="true" readonly SUMOLOGIC_COLLECTOR_NAME="${SUMOLOGIC_COLLECTOR_NAME:?}" + readonly NAMESPACE="${NAMESPACE:?}" + readonly SUMOLOGIC_SECRET_NAME="${SUMOLOGIC_SECRET_NAME:?}" # Set variables for terraform export TF_VAR_collector_name="${SUMOLOGIC_COLLECTOR_NAME}" + export TF_VAR_namespace_name="${NAMESPACE}" + export TF_VAR_secret_name="${SUMOLOGIC_SECRET_NAME}" export TF_VAR_chart_version="${CHART_VERSION:?}" - export TF_VAR_namespace_name="${NAMESPACE:?}" # Let's compare the variables ignoring the case with help of ${VARIABLE,,} which makes the string lowercased # so that we don't have to deal with True vs true vs TRUE @@ -499,7 +502,7 @@ data: fi # Kubernetes Secret - terraform import kubernetes_secret.sumologic_collection_secret sumologic/sumologic + terraform import kubernetes_secret.sumologic_collection_secret "${NAMESPACE}/${SUMOLOGIC_SECRET_NAME}" # Apply planned changes TF_LOG_PROVIDER=DEBUG terraform apply \ @@ -740,6 +743,10 @@ data: type = string } + variable "secret_name" { + type = string + } + variable "create_fields" { description = "If set, Terraform will attempt to create fields at Sumo Logic" type = bool diff --git a/tests/helm/testdata/goldenfile/terraform/traces.output.yaml b/tests/helm/testdata/goldenfile/terraform/traces.output.yaml index 82620b3a0..907ac2443 100644 --- a/tests/helm/testdata/goldenfile/terraform/traces.output.yaml +++ b/tests/helm/testdata/goldenfile/terraform/traces.output.yaml @@ -338,7 +338,7 @@ data: resource "kubernetes_secret" "sumologic_collection_secret" { metadata { - name = "sumologic" + name = var.secret_name namespace = var.namespace_name } @@ -354,11 +354,14 @@ data: readonly DEBUG_MODE=${DEBUG_MODE:="false"} readonly DEBUG_MODE_ENABLED_FLAG="true" readonly SUMOLOGIC_COLLECTOR_NAME="${SUMOLOGIC_COLLECTOR_NAME:?}" + readonly NAMESPACE="${NAMESPACE:?}" + readonly SUMOLOGIC_SECRET_NAME="${SUMOLOGIC_SECRET_NAME:?}" # Set variables for terraform export TF_VAR_collector_name="${SUMOLOGIC_COLLECTOR_NAME}" + export TF_VAR_namespace_name="${NAMESPACE}" + export TF_VAR_secret_name="${SUMOLOGIC_SECRET_NAME}" export TF_VAR_chart_version="${CHART_VERSION:?}" - export TF_VAR_namespace_name="${NAMESPACE:?}" # Let's compare the variables ignoring the case with help of ${VARIABLE,,} which makes the string lowercased # so that we don't have to deal with True vs true vs TRUE @@ -486,7 +489,7 @@ data: fi # Kubernetes Secret - terraform import kubernetes_secret.sumologic_collection_secret sumologic/sumologic + terraform import kubernetes_secret.sumologic_collection_secret "${NAMESPACE}/${SUMOLOGIC_SECRET_NAME}" # Apply planned changes TF_LOG_PROVIDER=DEBUG terraform apply \ @@ -579,6 +582,10 @@ data: type = string } + variable "secret_name" { + type = string + } + variable "create_fields" { description = "If set, Terraform will attempt to create fields at Sumo Logic" type = bool diff --git a/tests/helm/testdata/goldenfile/terraform/tracing-metrics-disabled.output.yaml b/tests/helm/testdata/goldenfile/terraform/tracing-metrics-disabled.output.yaml index 0215f1219..de0e7d0f6 100644 --- a/tests/helm/testdata/goldenfile/terraform/tracing-metrics-disabled.output.yaml +++ b/tests/helm/testdata/goldenfile/terraform/tracing-metrics-disabled.output.yaml @@ -338,7 +338,7 @@ data: resource "kubernetes_secret" "sumologic_collection_secret" { metadata { - name = "sumologic" + name = var.secret_name namespace = var.namespace_name } @@ -354,11 +354,14 @@ data: readonly DEBUG_MODE=${DEBUG_MODE:="false"} readonly DEBUG_MODE_ENABLED_FLAG="true" readonly SUMOLOGIC_COLLECTOR_NAME="${SUMOLOGIC_COLLECTOR_NAME:?}" + readonly NAMESPACE="${NAMESPACE:?}" + readonly SUMOLOGIC_SECRET_NAME="${SUMOLOGIC_SECRET_NAME:?}" # Set variables for terraform export TF_VAR_collector_name="${SUMOLOGIC_COLLECTOR_NAME}" + export TF_VAR_namespace_name="${NAMESPACE}" + export TF_VAR_secret_name="${SUMOLOGIC_SECRET_NAME}" export TF_VAR_chart_version="${CHART_VERSION:?}" - export TF_VAR_namespace_name="${NAMESPACE:?}" # Let's compare the variables ignoring the case with help of ${VARIABLE,,} which makes the string lowercased # so that we don't have to deal with True vs true vs TRUE @@ -498,7 +501,7 @@ data: fi # Kubernetes Secret - terraform import kubernetes_secret.sumologic_collection_secret sumologic/sumologic + terraform import kubernetes_secret.sumologic_collection_secret "${NAMESPACE}/${SUMOLOGIC_SECRET_NAME}" # Apply planned changes TF_LOG_PROVIDER=DEBUG terraform apply \ @@ -739,6 +742,10 @@ data: type = string } + variable "secret_name" { + type = string + } + variable "create_fields" { description = "If set, Terraform will attempt to create fields at Sumo Logic" type = bool