From ac0f4f6c613f983853738f9f0522cae4f6e436d4 Mon Sep 17 00:00:00 2001 From: kristofre Date: Wed, 6 Nov 2024 14:01:20 +0100 Subject: [PATCH] add otel_export_enable to aws and azure (#727) add otel_export_enable to aws and azure --- terraform/aws/Readme.md | 13 +++++++++++++ terraform/aws/main.tf | 1 + terraform/aws/variables.tf | 6 ++++++ terraform/azure/Readme.md | 14 ++++++++++++++ terraform/azure/acebox-azure.tf | 3 ++- terraform/azure/main.tf | 1 + terraform/azure/variables.tf | 10 ++++++++++ terraform/azure/versions.tf | 5 +++++ 8 files changed, 52 insertions(+), 1 deletion(-) diff --git a/terraform/aws/Readme.md b/terraform/aws/Readme.md index 6d276540d..b003d8429 100644 --- a/terraform/aws/Readme.md +++ b/terraform/aws/Readme.md @@ -95,6 +95,19 @@ This terraform script supports the use of custom domains via Route53. route53_zone_name = "" # Name of route53 zone (defaults to public zones) ``` +## Send OpenTelemetry Traces to Dynatrace + +It is possible to leverage the [Ansible OpenTelemetry callback plugin](https://docs.ansible.com/ansible/latest/collections/community/general/opentelemetry_callback.html) to send Traces to the Dynatraces API. + +The following variable need to be set to enable it: + +```hcl +otel_export_enable = true +``` + +> Note: The traces will be sent to the `dt_tenant/api/v2/otlp` endpoint +> Note: The api token specified in the `dt_api_token` variable needs to have the additional `openTelemetryTrace.ingest` scope + ## Useful Terraform Commands Command | Result diff --git a/terraform/aws/main.tf b/terraform/aws/main.tf index 1d605d2d8..a8976434b 100644 --- a/terraform/aws/main.tf +++ b/terraform/aws/main.tf @@ -155,6 +155,7 @@ module "provisioner" { extra_vars = var.extra_vars dashboard_user = var.dashboard_user dashboard_password = local.dashboard_password + otel_export_enable = var.otel_export_enable depends_on = [ aws_instance.acebox diff --git a/terraform/aws/variables.tf b/terraform/aws/variables.tf index c764dda59..43e0f9197 100644 --- a/terraform/aws/variables.tf +++ b/terraform/aws/variables.tf @@ -172,3 +172,9 @@ variable "vpc_enable_nat_gateway" { type = bool default = false } + +variable "otel_export_enable" { + type = bool + description = "Enable openetelemetry export to Dynatrace" + default = false +} \ No newline at end of file diff --git a/terraform/azure/Readme.md b/terraform/azure/Readme.md index 20a85f956..433e1741c 100644 --- a/terraform/azure/Readme.md +++ b/terraform/azure/Readme.md @@ -33,6 +33,7 @@ ```hcl azure_location = "" # azure location where you want to provision the resources + azure_subscription_id = "" # azure subscription id in which subcsription you want to provision the resources ``` Check out `variables.tf` for a complete list of variables @@ -64,6 +65,19 @@ This terraform script supports the use of custom domains via Azure DNS. dns_zone_name = "example.com" # Name of Azure DNS zone ``` +## Send OpenTelemetry Traces to Dynatrace + +It is possible to leverage the [Ansible OpenTelemetry callback plugin](https://docs.ansible.com/ansible/latest/collections/community/general/opentelemetry_callback.html) to send Traces to the Dynatraces API. + +The following variable need to be set to enable it: + +```hcl +otel_export_enable = true +``` + +> Note: The traces will be sent to the `dt_tenant/api/v2/otlp` endpoint +> Note: The api token specified in the `dt_api_token` variable needs to have the additional `openTelemetryTrace.ingest` scope + ## Useful Terraform Commands diff --git a/terraform/azure/acebox-azure.tf b/terraform/azure/acebox-azure.tf index 902b2fd17..d627b8e47 100644 --- a/terraform/azure/acebox-azure.tf +++ b/terraform/azure/acebox-azure.tf @@ -183,4 +183,5 @@ module "provisioner" { extra_vars = var.extra_vars dashboard_user = var.dashboard_user dashboard_password = local.dashboard_password -} + otel_export_enable = var.otel_export_enable +} \ No newline at end of file diff --git a/terraform/azure/main.tf b/terraform/azure/main.tf index 943fc94fc..5a9da1561 100644 --- a/terraform/azure/main.tf +++ b/terraform/azure/main.tf @@ -18,6 +18,7 @@ terraform { provider "azurerm" { features {} + subscription_id = var.azure_subscription_id } diff --git a/terraform/azure/variables.tf b/terraform/azure/variables.tf index 7c296d042..d49200a3e 100644 --- a/terraform/azure/variables.tf +++ b/terraform/azure/variables.tf @@ -12,6 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. +variable "azure_subscription_id" { + description = "Azure Subscription ID for provisioning the Azure resources" +} + variable "name_prefix" { description = "Prefix to distinguish the instance" default = "ace-box-cloud" @@ -92,3 +96,9 @@ variable "dashboard_password" { description = "ACE-Box dashboard password." default = "" } + +variable "otel_export_enable" { + type = bool + description = "Enable openetelemetry export to Dynatrace" + default = false +} \ No newline at end of file diff --git a/terraform/azure/versions.tf b/terraform/azure/versions.tf index 14e460796..36f812547 100644 --- a/terraform/azure/versions.tf +++ b/terraform/azure/versions.tf @@ -16,6 +16,11 @@ terraform { required_version = ">= 0.12.20" required_providers { +/* azurerm = { + source = "hashicorp/azurerm" + version = "~> 4.x" + } +*/ random = "~> 3.3.2" local = "~> 2.2.2" }